y, m, d = map(int, input().split(" ")) dic = {1:31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31} if y % 4 == 0 and y % 100 != 0 or y % 400 == 0: dic[2] = 29 ans = d for i in range(1, m, 1): ans += dic[i] print(ans)