def isrun(n): if n%4 == 0 and n%100 != 0: return True elif n%400 == 0: return True else: return False def func(): a, b, c = map(int, input().split()) two = 28 if isrun(a): two = 29 year_dic = {31:[1, 3, 5, 7, 8, 10, 12], 30:[4, 6, 9, 11], two:[2]} res = c for i in range(1, b): if i in year_dic[31]: res = res + 31 elif i in year_dic[30]: res = res + 30 elif i == 2: res = res + two print(res) if __name__ == "__main__": func()