import datetime
y, m , d = [int(i) for i in input().split(" ")]
a=datetime.date(y,m,d)
a+=datetime.timedelta(int(input()))
print(a.year,a.month,a.day)
da9adfc18bada03c7d3544242542919b90a00448
<mask token>

<mask token>
a += datetime.timedelta(int(input()))
print(a.year, a.month, a.day)

<mask token>
y, m, d = [int(i) for i in input().split(' ')]
a = datetime.date(y, m, d)
a += datetime.timedelta(int(input()))
print(a.year, a.month, a.day)

import datetime
y, m, d = [int(i) for i in input().split(' ')]
a = datetime.date(y, m, d)
a += datetime.timedelta(int(input()))
print(a.year, a.month, a.day)

import datetime
y, m , d = [int(i) for i in input().split(" ")]
a=datetime.date(y,m,d)
a+=datetime.timedelta(int(input()))
print(a.year,a.month,a.day)