loj#P3477. 「ROIR 2021 Day 2」日期

「ROIR 2021 Day 2」日期

Description

Translated from Chinese version of ROIR 2021 Day2 T1 Календарь на Альфе Центавра on this website.

On a exterior planet, there are mm months in one year, and dd days in one month, as well as ww days in a week.

To distinguish different days of a week, humans use words like Monday and Tuesday to do that, while people on that planet use lowercase letters aza\ldots z to represent different days in a week.

Given that Year 11, Month 11, Day 11 is represented by weekday a, your task is to find which weekday corresponds to Day ii, Month jj, Year kk.

Input Format

The input file consists of two lines.

In the first line, there are three integers, respectively d, m, wd,~m,~w and three integers i, j, ki,~j,~k in the next line, respectively.

Output Format

Output a letter representing the weekday of the given date.

30 12 7
18 1 2021
b

Constraints

For all subtasks, it is guaranteed that 1d,m1001\le d,m\le 100, 1w261\le w\le 26, 1id1\le i\le d, 1jm1\le j\le m, 1k1091\le k\le 10^9.

Subtask # Additional Constraints Score
11 d=m=1d=m=1 1616
22 m=1m=1k107k\le 10^7
33 i=j=1i=j=1 1717
44 k=1k=1
55 k100k\le 100
66 No additional constraints.