import sys
input = sys.stdin.readline
E, S, M = map(int, input().split())
count = 1
e, s, m = 1, 1, 1
while True:
if e == E and s == S and m == M:
break
count += 1
e += 1
s += 1
m += 1
if e > 15:
e = 1
if s > 28:
s = 1
if m > 19:
m = 1
print(count)
Brute Force 알고리즘이다. 브루트 포스 알고리즘은 사람 이름이 아니라 무차별 대입이라고도 하며 단순히 다 대입하면서 정답을 구하는 알고리즘이다.