#P1424. Swimming Fish Distance Calculation
Swimming Fish Distance Calculation
Swimming Fish Distance Calculation
A little fish swims 250 km on each weekday, while it rests on weekends (Saturday and Sunday). Given a starting day of the week x (where Monday is 1, Tuesday is 2, ..., Sunday is 7) and n consecutive days, compute the total distance the fish has swum after n days.
For example, if x=1 (Monday) and n=7, then the fish swims on Monday to Friday and rests on Saturday and Sunday, yielding a total of 5 * 250 = 1250 km.
The formula is: \( \text{Total Distance} = 250 \times (\text{number of weekdays in n days starting from day } x) \).
inputFormat
The input contains two integers x and n separated by a space:
- x: an integer (1 ≤ x ≤ 7) representing the starting day of the week (1 for Monday, 7 for Sunday)
- n: the number of days
outputFormat
Output a single integer representing the total kilometers swum by the fish after n days.
sample
1 7
1250