import datetime
y,m,d = map(int,input().split())
print(datetime.date(y,m,d).strftime('%j').lstrip('0'))