Simplified Calendar System

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Consider a simplified calendar system where each year is 12 months and each month is 30 days, i.e., each year is 360 days. This sure makes the math easy, or does it?

Given a date and what day of the week it is, determine what day of the week a second date is. The second date will be after (timewise) the first date.

입력

There are two input lines. The first input line contains four integers:

  • d (1 ≤ d ≤ 30), providing what day of the month the first date is,
  • m (1 ≤ m ≤ 12), providing what month of the year the first date is,
  • y (1000 ≤ y ≤ 2999), providing what year the first date is, and
  • n (1 ≤ n ≤ 7), providing what day of the week the given date is (1 represents Sunday, 2 represents Monday, …, 7 represents Saturday).

The second input line provides the second date; it contains three integers (similar to the first three integers of the first input line). Again, the second date will be later than the first date (timewise).

출력

Print an integer (between 1 and 7, inclusive) indicating what day of the week the second date is.