Under construction

Still being built. Things may change

Devil's Annual Leave Calculator

Interview

Time limit1sMemory limit512 MB

Summary
Given a joining date and a later date on a 30-day month, 12-month year calendar, compute total monthly and annual leave earned plus days of service.
Level

Medium4 of 10

Topics
Implementation, Math, Simulation, Brute force
Solved
No attempts yet

Problem

Note: This problem assumes a fictional calendar where a month has 30 days and a year has 12 months, instead of the usual calendar.

Anyone who works a full year (360 days) deserves vacation. So our company wants to give annual leave and monthly leave. Using annual leave or monthly leave lets you rest for a day. But because we are so short-staffed, the annual leave and monthly leave we can hand out have shrunk to almost nothing. The employees, unaware of this internal situation, are happy to receive their leave. When employees work a lot, the boss is happy. Anyway, to further improve the employees' convenience, we want to show each person the calculated result of their annual and monthly leave, raising job satisfaction.

So let us look at how each is calculated. First, the day of joining counts as month 0, and the NN-th year means the state 12×N12 \times N months after the day of joining.

  1. Monthly leave and annual leave are granted on the same day of each month and each year as the joining day.
  2. Monthly leave is granted one at a time for every 1 month (30 days) that passes, up to the 3rd year (month 36). That is, at most 36 can be granted.
  3. Annual leave is granted at A+15A + 15 per year.
  4. However, on the day of joining, no annual or monthly leave is granted.

The value of AA starts at 0 when you join and increases by 1 every 2n+12n + 1 years (n=1,2,...n = 1, 2, ...). For example, in years 1 and 2, A=0A = 0. After that, in years 3 and 4, A=1A = 1, and in years 5 and 6, A=2A = 2.

Employees enter two dates SS and EE into the system. SS is the joining date, and EE is some future date relative to SS. Our job is to build a system that reports the total number of annual and monthly leave obtainable and the length of service when someone joins on date SS and works until date EE. The length of service means how many days have passed since the user joined.

Please~ make it~

Input

SS and EE are given over two lines in the format Year Month Day. Each number is separated by a space.

  • 1≤1\leq Year ≤9999\leq9999
  • 1≤1\leq Month ≤12\leq12
  • 1≤1\leq Day ≤30\leq30

The second date given is a future date relative to the first date. That is, S<ES < E.

Output

On the first line, print the total number of annual and monthly leave, separated by a space. On the second line, print the total length of service followed by days. Even if the length of service is 1 day, you must print days, not day.

Examples3

  1. Example 1

    Input
    2021 11 21
    2022 11 21
    
    Expected output
    15 12
    360days
    
  2. Example 2

    Input
    2021 11 11
    2025 12 30
    
    Expected output
    62 36
    1489days
    
  3. Example 3

    Input
    1 1 1
    9999 12 30
    
    Expected output
    25134972 36
    3599639days