      program onsprec

      implicit none
      real, dimension(144,157)     :: prec1
      real, dimension(144,157)     :: prec
      integer                      :: ind,i,j
      real                         :: lati,loni
      character (len=120)           :: arqfct,arqout,arqoutbin

      prec=0.
      open (9,file='fctlist', form='formatted', status='old')

      read(9,'(a120)')arqout
      read(9,'(a120)')arqoutbin

 900  read(9,'(a120)',end=910) arqfct

      write(*,*)arqfct
      open(11,file=arqfct,form='unformatted',status='old',access='direct',recl=4*144*157)

      read(11,rec=13)prec1
      prec=prec+(prec1*1000)

      goto 900

 910  continue

      open(10,file=arqout,form='formatted',status='unknown')
      open(12,file=arqoutbin,form='unformatted',status='unknown')
      loni=-83.00
      lati=-50.20
      do j=1,144
        do i=1,157
          write(10,'(f6.2,1x,f6.2,1x,f5.1)')loni,lati,prec(j,i)
          lati=lati+0.40
        enddo
          lati=-50.20
          loni=loni+0.40
      enddo

      write(12)prec
      close(10)
      close(12)
      end program onsprec
