#P9765. [ROIR 2021] 日期 (Day 2)

[ROIR 2021] 日期 (Day 2)

Background

Translated from ROIR 2021 Day 2 T1 Календарь на Альфе Центавра

Problem Description

On an alien planet, a year has mm months, each month has dd days, and a week has ww days.

To distinguish each day in a week, humans use weekday names, while the residents of this planet use lowercase English letters a\simz to represent each day of the week.

It is known that Year 11 Month 11 Day 11 corresponds to weekday a. Find which weekday Year kk Month jj Day ii corresponds to.

Input Format

The first line contains three integers d,m,wd,m,w

The second line contains three integers i,j,ki,j,k

Output Format

Output a single letter, representing which weekday Year kk Month jj Day ii corresponds to.

30 12 7
18 1 2021
b

Hint

Constraints:

For all subtasks, 1d,m1001\le d,m\le 1001w261\le w\le 261id1\le i\le d1jm1\le j\le m1k1091\le k\le 10^9

Subtask ID Special 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 special constraints

Translated by ChatGPT 5