Input

N, long integer 

Interface

                  | 
ReverseJulianDate(N, J, K, I) 
                     |  |  | 

Process

BEGIN 
  M <- N - 1721119 
  I <- (4 * M - 1) div 146097 
  M <- (4 * M - 1) mod 146097 
  K <- M div 4 
  M <- (4 * K + 3) div 1461 
  K <- (4 * K + 3) mod 1461 
  K <- (K + 4) div 4 
  J <- (5 * K - 3) div 153 
  K <- (5 * K - 3) mod 153 
  K <- (K + 5) div 5 
  I <- 100 * I + M 
  IF J < 10 THEN 
    J <- J + 3 
  ELSE 
    J <- J - 9 
    I <- I + 1 
  ENDIF 
END 
meatgrinder

Output

J, integer 
K, integer 
I, integer

Notes

Determines the month, day, and year corresponding to a unique, seven-digit number N.
J is month, K is day of month and I is 4-digit year.

Examples

Input                Output 
N                    J      K      I 
2447182              1      21     1988 
2450000              10     9      1995 
2431007              10     9      1943 
2428056              9      10     1935 

Notation

<- means is replaced by 
J div K yields the quotient after long division of J by K 
J mod K yields the remainder after long division of J by K