       PROGRAM SOI_RW
       IMPLICIT NONE
       CHARACTER*1 AA
       INTEGER IANDEB,IANFIN,IAN
       INTEGER IH,IM,IMONTH
       PARAMETER (IANDEB=1876,IANFIN=2003,IMONTH=12)
       REAL YEAR,SOI(0:IMONTH+1)

       OPEN(10,file='../input/soi_76_03.txt',form='formatted')
       OPEN(11,file='../out_soi/soi_76_03_3m.dat',form='formatted')
       OPEN(12,file='../out_soi/soi_76_03_1m.dat',form='formatted')

       do ih=1,5
       read(10,*)AA
       print *,AA

       enddo


       do ian=IANDEB,IANFIN
       read(10,*)YEAR,(SOI(IM),IM=1,IMONTH)
       print *,YEAR,SOI(1)
       do IM=1,IMONTH-1,3
          write(11,110)YEAR+FLOAT(IM+1)/FLOAT(IMONTH)
     C           ,(SOI(IM)+SOI(IM+1)+SOI(IM+2))/3.
       enddo
       do IM=1,IMONTH
          write(12,110)YEAR+FLOAT(IM-1)/FLOAT(IMONTH),SOI(IM)
       enddo
       enddo

 110   format(f9.4,1x,f6.2)
       stop
       end


