시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 91 21 20 27.778%

문제

상근이와 중근이는 천문학 수업을 듣고 있다. 이번주 과제는 흔치 않은 별 두 개를 관찰하는 것이다. 두 사람은 별을 관찰하면서 반짝이는 시간을 적어놓았다. 관찰한 결과를 살펴보니 두 별은 주기적으로 반짝인다는 사실을 알게되었다. 어느날 두 별이 처음으로 반짝인 시간과 반짝이는 주기가 주어졌을 때, 언제 동시에 반짝이는지 구하는 프로그램을 작성하시오.

예를 들어, 첫 번째 별이 오늘(토요일) 02:20, 두 번째 별이 13:00에 반짝였고, 첫 번째 별이 반짝이는 주기는 05:50 (5시간 50분), 두 번째 별은 01:00 (1시간) 이라고 하자. 그러면, 첫 번째 별은 08:10, 14:00에 반짝일 것이고, 두 번째 별은 14:00에 반짝일 것이다. 따라서, 두 별은 오늘 14:00에 동시에 반짝인다.

00:00 (자정)은 그 날의 첫 시간이다.

입력

네 줄 걸쳐에 HH:MM (시:분) 형식의 시간이 주어진다. (00 ≤ HH ≤ 23, 00 ≤ MM ≤ 59)

첫째 줄의 시간은 첫 번째 별이 반짝인 시간, 둘째 줄은 두 번째 별이 반짝인 시간, 세 번째 줄은 첫 번째 별이 반짝이는 주기, 네 번째 줄은 두 번째 줄이 반짝이는 주기이다.

처음 두 시간은 항상 다르며, 오늘은 토요일(Saturday)이다. 반짝이는 주기는 00:00이 아니다.

출력

만약, 두 별이 동시에 반짝이지 않는다면 "Never"를 출력한다.

첫째 줄에 두 별이 동시에 반짝이는 날의 요일을 출력한다. (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday)

둘째 줄에는 동시에 반짝인 시간을 HH:MM형식으로 출력한다.

예제 입력 1

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

예제 출력 1

Saturday
14:00

힌트

W3sicHJvYmxlbV9pZCI6IjI4NTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJjYzQgXHVhZDAwXHVjYzMwIiwiZGVzY3JpcHRpb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