시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 149 31 27 26.471%

문제

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

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