program walk
implicit none
real::r,d,dmean,sum
integer::x,y,i,j,k
real,dimension(100,2)::c

  do j=1,100
	x=0
	y=0
      do k=1,10  
	do i=1,1000*j
	    call random_number(r)
	
	   if(r<0.25) then
	      x=x+1
           else if((r-0.25)<0.25) then
	      y=y+1
	   else if((r-0.5)<0.25)  then
	      x=x-1
	   else 
	      y=y-1	
	   end if
	   if (J==10) then
             open(1,file="walk.dat")
	     write(1,*)x,y
	   end if
        enddo
	close(1)	
	  d=sqrt(real(x)**2+real(y)**2)
          sum=sum+d
      enddo
      dmean=sum/10.0  

	c(j,1)=dmean
	c(j,2)=sqrt(1000*real(j))
   enddo
	open(2,file="plot.dat")
	write(2,*)c
	close(2)
	
end program

	   
	
