      program addequt
C..Add time UT of Mmax(EQ) EQ daily Mmax, Dkm, Mav, glat,glon set, for the day of Kpmax<3...........June 2022
C
      CHARACTER*64 infile,outfile,infileq
	CHARACTER*4 AYEAR
		CHARACTER*2 AMN,ADY,AUT,AMM
C
C+      outfile='addeqkp0.txt'
C+	infile='addeqkp0jm.res'
         outfile='addeqssn0.txt'
       infile='addeqkpssn0.txt' ! all SSN=0  1994-2020
	infileq='d:\Apkp\Equak\Obninsk\eqYEAR.txt'
C+      outfile='addeqkp3.txt'
C+	infile='addeqkp3jm.res'
C
       OPEN(11,file=outfile)
 	OPEN(12,file=infile,action='READ')
C
   30 format(1X,I4,2(1X,I2),2X,2I2,F4.1,3X,F6.2,1X,F6.2,2X,I4,1X,F4.1
     +,1X,I4)
	ndy=0
C
	DO 41 iev=1,2000
  	read(12,32,end=55) ryear,lda,imn,idy,glats,glons,kmds
 	+,aeqmax,eqav,kk,knum,ndy1
C-		if (iev.lt.91) goto 41
C
            iyear=int(ryear)
	iyr=iyear-iyear/100*100
		  call blet4(iyear,ayear)
	infileq(25:28)=AYEAR
	OPEN(10,file=infileq,action='READ')
C    1	read(10,30,end=51) kyear,kmn,kdy,kut,kmm,sec,glat,glon,khei,eqm,kn
    1	read(10,*,end=51) kyear,kmn,kdy,rutmmss,glat,glon,khei,eqm,kn
Crem      if ((kyear.eq.iyear).and.(kn.eq.knum)) then   !>>>>>>>>>>>>>>>>>>>>>>
      if ((kmn.eq.imn).and.(kdy.eq.idy).and.(kn.eq.knum)) then   !>>>>>>>>>>>>>>>>>>>>>>
	 iutmmss=int(rutmmss)
	iut=iutmmss/10000
	immss=iutmmss-iut*10000
	imm=immss/100
	iss=immss-imm*100
      rmm=imm+iss/60.
C
	if (rmm.lt.7.5) imm=0
      if ((rmm.ge.7.5).and.(rmm.lt.22.5)) imm=15
      if ((rmm.ge.22.5).and.(rmm.lt.37.5)) imm=30
	if ((rmm.ge.37.5).and.(rmm.lt.60.0)) imm=45
C?	if (rmm.gt.52.5) then
C?	imm=0
C?	iut=iut+1
C?	if (iut.gt.23) then		 !+++
C?	iut=0
C?	lda=lda+1
C?	call submmdd(lda,iyr,imn,idy)
C?	endif                    !+++
C?	  endif
C
    2  ndy=ndy+1
      call blet2(imn,AMN)
	call blet2(idy,ADY)
	call blet2(iut,AUT)
      call blet2(imm,AMM)
      write(*,33) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
	+,aeqmax,eqav,kk,knum,ndy
	write(11,33) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
	+,aeqmax,eqav,kk,knum,ndy
	                 else   !>>>>>>>>>>>>>>>>>
	goto 1
	                 endif !>>>>>>>>>>>>>>>>>>>
C
   51 close(10)
   41 continue
   32 format(1X,F8.3,1X,I3,2(1X,I2),2(1X,F6.2),1X,I4,2(1X,F4.1)
     +,3(1X,I4))
   33 format(1X,F8.3,1X,I3,4(1X,A2),2(1X,F6.2),1X,I4,2(1X,F4.1)
     +,3(1X,I4))
   55	close(unit=12)
	close(unit=11)
	pause ' '
	STOP
	END