시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 165 35 32 23.358%

문제

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

예를 들어, 첫 번째 별이 오늘(토요일) 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
W3sicHJvYmxlbV9pZCI6IjI4NTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJjYzQgXHVhZDAwXHVjYzMwIiwiZGVzY3JpcHRpb24i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