      PROGRAM REPORTDAY
      
      INTEGER YEAR, MONTH, DAY
      INTEGER Y, D
      LOGICAL LEAPYR, LEAP
      
      PRINT *, 'THIS IS A PROGRAM THAT CALCULATES THE NUMBER OF DAYS'
      
      PRINT *,'INPUT THE YEAR'
      READ *, YEAR
      IF (YEAR .LT. 2000) THEN
      	PRINT *, 'WRONG YEAR ', YEAR
      	STOP
      ELSE
      	PRINT *, 'YEAR = ', YEAR
      ENDIF
      
      LEAPYR = (MOD(YEAR, 400) .EQ. 0 .OR. (MOD(YEAR, 4) .EQ. 0 .AND. 
     + MOD(YEAR, 100) .NE. 0))
      IF (LEAPYR) THEN 
      	PRINT *, 'THIS IS A LEAP YEAR'
      ENDIF
      
      PRINT *,'INPUT THE MONTH'
      READ *, MONTH
      IF (MONTH .LT. 0 .OR. MONTH .GT. 12) THEN
      	PRINT *, 'WRONG MONTH ', MONTH 
      	STOP
      ELSE
      	PRINT *, 'MONTH = ', MONTH
      ENDIF
      
      PRINT *,'INPUT THE DAY'
      READ *, DAY
      IF (MONTH .EQ. 1) THEN
      	IF (DAY .LT. 1 .OR. DAY .GT. 31) THEN
      	  PRINT *, 'WRONG MONTH ', MONTH 
      	  STOP
      	ENDIF
      ELSE IF (MONTH .EQ. 2) THEN
      	IF ((DAY .LT. 1) .OR. ((DAY .GT. 29) .AND. LEAPYR) .OR. 
     + (DAY .GT. 28 .AND. (.NOT. LEAPYR))) THEN
      	  PRINT *, 'WRONG DAY ', DAY 
      	  STOP
      	ENDIF
      ENDIF
      PRINT *, 'DAY = ', DAY
      
      TOTALD = 0
      DO 10 Y = 2000, YEAR - 1
      	LEAP = (MOD(Y, 400) .EQ. 0 .OR. (MOD(Y, 4) .EQ. 0 .AND. 
     + MOD(Y, 100) .NE. 0))
      	IF (LEAP) THEN
      	  TOTALD = TOTALD + 366
      	ELSE
	  TOTALD = TOTALD + 365
	ENDIF
10    CONTINUE
      PRINT *, 'TOTAL # OF DAYS (AFTER COUNTING YEARS) = ', TOTALD
      
      IF (MONTH .EQ. 1) THEN
      	TOTALD = TOTALD + 0
      ELSE IF (MONTH .EQ. 2) THEN
      	TOTALD = TOTALD + 31
      ELSE IF (MONTH .EQ. 3) THEN
        TOTALD = TOTALD + 31 + 28
      ELSE IF (MONTH .EQ. 4) THEN
      	TOTALD = TOTALD + 31 + 28 + 31
      ELSE IF (MONTH .EQ. 5) THEN
      	TOTALD = TOTALD + 31 + 28 + 31 + 30
      ELSE IF (MONTH .EQ. 6) THEN
      	TOTALD = TOTALD + 31 + 28 + 31 + 30 + 31
      ELSE IF (MONTH .EQ. 7) THEN
      	TOTALD = TOTALD + 31 + 28 + 31 + 30 + 31 + 30
      ELSE IF (MONTH .EQ. 8) THEN
      	TOTALD = TOTALD + 31 + 28 + 31 + 30 + 31 + 30 + 31	 
      ELSE IF (MONTH .EQ. 9) THEN
      	TOTALD = TOTALD + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31	 
      ELSE IF (MONTH .EQ. 10) THEN
      	TOTALD = TOTALD + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31	+ 30
      ENDIF
      	
      IF (LEAPYR .AND. MONTH .GT. 2) THEN
        TOTALD = TOTALD + 1
      ENDIF
      
      PRINT *, 'TOTAL # OF DAYS (AFTER COUNTING MONTH) = ', TOTALD
      
      TOTALD = TOTALD + DAY - 1
      PRINT *, 'TOTAL # OF DAYS (AFTER COUNTING DAY) = ', TOTALD
      
      D = MOD(TOTALD + 6, 7)
      PRINT *, 'D = ', D
      
      
      STOP
      END
      
      