#B3921. Exam Day Calculation

    ID: 11578 Type: Default 1000ms 256MiB

Exam Day Calculation

Exam Day Calculation

Today is weekday \(X\) and there are \(N\) days remaining until the exam. In this problem, weekdays are represented by numbers where \(1\) represents Monday and \(7\) represents Sunday. You are required to compute the weekday on which the exam will take place. The formula to calculate the exam day is:

\[ \text{exam\_day} = ((X - 1 + N) \mod 7) + 1 \]

For example, if today is \(X = 3\) (Wednesday) and \(N = 4\), then the exam day will be:

\(\text{exam\_day} = ((3 - 1 + 4) \mod 7) + 1 = (6 \mod 7) + 1 = 7\)

inputFormat

The input consists of two integers \(X\) and \(N\) separated by space in a single line, where:

  • \(X\) is an integer between 1 and 7 (inclusive), with 7 representing Sunday.
  • \(N\) is a non-negative integer representing the number of days remaining until the exam.

outputFormat

Output a single integer representing the weekday on which the exam will occur, using the same numbering as the input (i.e., 7 represents Sunday).

sample

1 1
2