Rain Diary
InterviewTime limit1sMemory limit1024 MB
Given today's day number n and the day m from the record two weeks ago, print the day number for last Sunday's record.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Petya lives in Saint Petersburg and is keen on meteorology. It is widely believed that it constantly rains in Saint Petersburg. Petya wants to test this claim with statistics. Every Sunday he records whether it rained that day. Each record is signed with the day number in the month, numbered from 1 to the number of days in that month (28 to 31, depending on the month).
Today Petya opened his diary and realized he forgot to make a record last Sunday. He remembers that there was heavy rain a week ago. He decides to make two records, one for today and one for last Sunday. He knows the current day number and sees the number written in the record from two weeks ago. What number should Petya sign his record for last Sunday with?
Input
The first line contains two integers and (), the number of the current day of the month and the number written in the record from two weeks ago.
Output
Output a single number, the number Petya should sign his record for last Sunday with.