      PROGRAM WRTBIAS
      CHARACTER*10 CHFILE
*      PARAMETER (NFILE=5)
      PARAMETER (NFILE=2)
      DIMENSION F(NFILE),IFILE(NFILE),FOLD(NFILE)
      DATA IFILE /33,35/
*      DATA IFILE /32,33,34,35,36/
*      DATA FOLD /5*0./
      DATA FOLD /2*0./
   
      
*      OPEN(29,FILE='p10/TPCbias.txt')
*      READ(29,*)
*      READ(29,*)
*      READ(29,*)
*      READ(29,*)
      
      OPEN(30,FILE='bias.out')
      DO I=1,NFILE
         WRITE(CHFILE,'(A5,I2)')'fort.',IFILE(I)
         OPEN(IFILE(I),FILE=CHFILE)
      ENDDO
      
      IOS = 0
      DO I=1,NFILE
         READ(IFILE(I),*,END=10,ERR=10) 
      ENDDO
      DO WHILE(IOS.EQ.0)
         DO I=1,NFILE
            READ(IFILE(I),*,END=10,ERR=10) X,Y,E,F(I)
         ENDDO

*         READ(29,*)XX,FOLD
*         print*,xx,f(4),fold(4)

         WRITE(30,99)X+0.2,(F(I)+FOLD(I),I=1,NFILE)
      ENDDO

 10   CONTINUE

      WRITE(30,99)X+0.6,(0.,I=1,NFILE)
 99   FORMAT(10F10.5)
 
      END
