Dolphin loves programming contests. Today, he will take part in a contest in AtCoder. In…
- User
Dolphin loves programming contests. Today, he will take part in a contest in AtCoder. In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock". The current time is A o'clock, and a contest will begin in exactly B hours. When will the contest begin? Answer in 24-hour time.
Constraints
- 0 \leq A,B \leq 23
- A and B are integers. Input
The input is given from Standard Input in the following format:
A B
Output
Print the hour of the starting time of the contest in 24-hour time.
Examples
Input
9 12
Output
21
Input
19 0
Output
19
Input
23 2
Output
1
Assistant
We are to solve: Given current hour A (0..23) and B hours later, compute (A + B) mod 24. Note that if mod is 0, but we want 0? Actually typical 24-hour clock runs from 0 to 23? Usually 0:00 is midnight, but maybe they denote 0 as 0 o'clock? In examples, Input: 23 2 => Output: 1. (23+2)=25 mod 24 = 1, good. Input: 19 0 => output 19. Good. Input: 9 12 => 21 mod 24 = 21. So yes, answer = (A+B)%24.
We must output the hour as integer.
Implementation: read A and B as ints, compute (A+B)%24, print.
That is all.
But the problem is simple. However note the constraints: A and B are integers between 0 and 23 inclusive. So sum up to 46, but mod 24.
Edge case: A=0, B=0 => output 0? (0+0)%24 = 0. So output 0. Is that acceptable? Typically maybe 0:00 is 0 o'clock? In some contexts, they might say 24 o'clock for midnight? But the examples not include that. However the problem statement: "24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock"." So they refer to 21 for 9pm. That suggests they use hours from 0 to 23? Usually 24-hour clock runs 0:00 to 23:59. But sometimes "24:00" is used for midnight at end of day. However given constraints and examples, they likely expect (A+B) mod 24 with 0 for 0. So fine.
Thus solution: read from input, compute, print.
Now I need to produce final answer: Probably just the code.
But the problem might expect handling if result is 0? The problem statement: "Print the hour of the starting time of the contest in 24-hour time." Possibly they want between 0 and 23 inclusive. So it's fine.
So final solution in Python:
def main(): import sys A, B = map(int, sys.stdin.read().split()) print((A + B) % 24)
if name == "main": main()
That's it.
Now produce the answer. ```python
import sys
def main() -> None: A, B = map(int, sys.stdin.read().split()) print((A + B) % 24)
if name == "main": main()