brute force 기법을 사용해서 하나 하나 증가시키며 비교한다.
import sys
input = sys.stdin.readline
E , S, M = map(int,input().split())
e, s, m = 1 , 1 , 1
year = 1
while(True):
if e==E and s==S and m==M:
print(year)
break
e += 1
s += 1
m += 1
year += 1
if e == 16 : e = 1
if s == 29 : s = 1
if m == 20 : m = 1
import sys
input = sys.stdin.readline
E , S, M = map(int,input().split())
year = 1
while(True):
if year % 15 == E :
if year % 28 == S :
if year % 19 == M:
print(year)
break
year = year + 1