      Program Plain
C     If you input Plain.dat [xx,yy,yn,xn,yi,xi],
C     to output Lain.dat that is used in program [Plain2].
C     Parameter
C     XX : length for each subfaults [ Strike ] delta X
C     YY : length for each subfaults [ Dip ]    delta Y
C     Xn : Number of subfaults [ Strike ]       M
C     Yn : Number of subfaults [dip]            N
C     Xi Yi : hypocenter                        X0, Y0
C     Pleace refer to  Yagi et al. (zishin),1998, vol 51, 139-148
C

      real x(500),y(500)
      integer xn,yn
      open(77,file='Plain.dat')
      read(77,*)xx,yy,xn,yn,xi,yi
      write(6,*)"Xnumber=",xn,"Ynumber=",yn
      write(6,*)"Xscale=",xx,"Yscale=",yy
      write(6,*)"Xinitial=",xi,"Yinitial=",yi
      open(10,file='Line.dat')
cc===Calculation==================
      x(1)=-xx*(xi-0.5)
      y(1)=-yy*(yi-0.5)
      do i=2,xn+1
         x(i)=x(i-1)+xx
      end do
      do i=2,yn+1 
         y(i)=y(i-1)+yy
      end do
      write(10,*)(xn+yn+2)*2
      do i=1,xn+1
         write(10,*)-y(i),x(1)
         write(10,*)-y(i),x(yn+1)
      end do
      do i=1,yn+1
         write(10,*)-y(1),x(i)
         write(10,*)-y(xn+1),x(i)
      end do
      stop 
      end  
      

