시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 87 20 19 27.941%

문제

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

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