y, n, d = list(map(int, input().split())) def is_leap(year): if year % 400 == 0: return True if year % 100 == 0: return False if year % 4 == 0: return True return False c = 366 if is_leap(y) else 365 print(max(0, n - d), min(c - d, n))