# 3083 : 12歳 import calendar import datetime from sys import stdin year,numSt,daysAfter=list(map(int,stdin.readline().split())) isLeapYear=1 if calendar.isleap(year+1) else 0 dt41=datetime.datetime(year=year, month=4, day=1) dt228=datetime.datetime(year=year+1, month=2, day=28) dt41NextYear=datetime.datetime(year=year+1, month=4, day=1) dtLeap=dt228-dt41 if not isLeapYear: minNumSt=max(numSt-daysAfter,0) maxNumSt=min(numSt,365-daysAfter) elif daysAfter<=dtLeap.days: minNumSt=max(numSt-daysAfter,0) maxNumSt=min(numSt,(365+isLeapYear)-daysAfter) else: daysAfter-=1 minNumSt=max(numSt-daysAfter,0) maxNumSt=min(numSt,365-daysAfter) print('{0} {1}'.format(minNumSt,maxNumSt))