Input

J, integer
K, integer 
I, 4-digit integer

Interface

           |  |  | 
JulianDate(J, K, I) 
     |

Process

BEGIN 
  IF J > 2 THEN 
    M <- J - 3 
    Y <- I 
  ELSE 
    M <- J + 9 
    Y <- I - 1 
  ENDIF 
  C <- Y div 100 
  D <- Y mod 100 
  P <- (146097 * C) div 4 
  Q <- (1461 * D) div 4 
  R <- (153 * M + 2) div 5 
  N <- P + K + Q + 1721119 + R 
  JulianDate <- N 
END 
meatgrinder

Output

JulianDate, long integer 

Notes

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

Examples

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

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