      program epochmed
C.......................................................Feb 2020
	DIMENSION CC(136,72),SMED(72)
	CHARACTER*50 infile,outfile
			COMMON /BL1/CC,SMED
C
C       infile='hsskp3s.txt'
c       infile='hssap3s.txt'
C       infile='hssaa3s.txt'
C       infile='hsssw3s.txt'
C       infile='hssae3s.txt'
C       infile='hssau3s.txt'
C       infile='hssal3s.txt'
C       infile='hssds3s.txt'
       infile='hsswp3s.txt'
C	outfile='medkps.txt'
C	outfile='medaps.txt'
C	outfile='medaas.txt'
C	outfile='medsws.txt'
C	outfile='medaes.txt'
C	outfile='medaus.txt'
C	outfile='medals.txt'
C	outfile='meddss.txt'
	outfile='medwps.txt'
	OPEN(10,file=infile,action='READ')
	OPEN(11,file=outfile)
	DO 30 kk=1,136
	read(10,*,end=40) (CC(kk,k),k=1,72)
   30 continue
   40 close(unit=10)

       coef=1.
       do m=1,136
	do k=1,72
	if (CC(m,k).lt.0.) then
	coef=-1.
	CC(m,k)=coef*CC(m,k)
	endif
	enddo
	enddo
      call submed136(136,72)
C      call submed136(105,72)
   29 format(1X,F7.2)
	do n=1,72
C	xmed=smed(n)/10. ! kp
	xmed=smed(n)*coef ! ap
	write(*,29) xmed
	write(11,29) xmed
	enddo
	close(unit=11)
	pause ' '
	STOP
	END
		 
