program ab
  use sep
  integer :: n1,n2
  integer :: iloc
  integer :: i2,i1,i
  real,allocatable :: b1(:,:),b2(:,:)


  call sep_init()
  call from_history("n1",n1)
  call from_history("n2",n2)
  call from_param("iloc",iloc,200)

  allocate(b1(N1,N2),b2(n1,n2))
  call sreed("in",b1,size(b1)*4)

  do i2=1,n2
   do i1=1,n1
      i=(iloc-i2)-i1
      if(i < 1) i=i+n1
      if(i >n1) i=i-n1
      b2(i1,i2)=b1(i,iloc)
  end do
end do



  call srite("out",b2,size(b2)*4)

end program
