#1017
Unrated
ASTRO
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Adrian Satja Kurdija

Ivica and Marica are attending astronomy classes and are observing two unusual stars. They noted the time when each of them flashed. They further noticed that each of the stars flashes periodically, at regular intervals, and now they are wondering: on what day, at what hour will the stars flash at the same minute for the first time? For example, if the first star flashed today (Saturday) at 02:20 and the second one at 13:00, with the first star flashing every 05:50 (every 5 hours and 50 minutes) and the second every 01:00 (each hour), then the first one will flash again at 08:10 and 14:00, and the second one at 14:00. Therefore, both stars will have flashed at the same minute today at 14:00. Note that the time 00:00 (midnight) is the first minute of a day.

입력

Four lines containing four timestamps in HH:MM format (hours:minutes), with 00 ≤ HH ≤ 23, 00 ≤ MM ≤ 59. The timestamps are, respectively: the time of the first star’s flash, the time of the second star’s flash, the time between consecutive flashes of the first star, the time between consecutive flashes of the second star. The first two timestamps will differ, and both fall on the same day - Saturday. Flash intervals will not be 00:00.

출력

If the stars will never flash at the same minute, output “Never” in a single line. Otherwise, output in the first line (all lowercase) the name of the weekday of the first same-minute flash. A reminder on the correct spelling of weekdays: “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday” and “Saturday” (note the capital letter). In the second line, output the timestamp of the first same-minute flash, in HH:MM format (with a leading zero if HH < 10). Author: Adrian Satja Kurdija

예제 입력 1

02:20
13:00
05:50
01:00

예제 출력 1

Saturday
14:00

예제 입력 2

02:20
23:28
00:40
23:50

예제 출력 2

Never

예제 입력 3

23:19
10:19
02:42
09:11

예제 출력 3

Thursday
00:31
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.