Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/integer-bir-necha-kundan-keyin

In a few days

Medium 1000 ms 64 MB 37%
Share

The days of the week are numbered: $1$ — Monday, $2$ — Tuesday, …, $7$ — Sunday. Today is day $d$ of the week. Find which day of the week it will be in $k$ days.

Moving around the circle of weekdays

Input

One line with two integers: $d$ and $k$.

Output

One integer from $1$ to $7$.

Note

$1 \le d \le 7$
$0 \le k \le 10^{9}$

Examples

Input #1
3 5
Output #1
1
Input #2
7 0
Output #2
7

Sign in to submit a solution

Signing up is free and takes a minute.