#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main() {
int y, n;
while (cin >> y >> n) {
bool flag = false;
if ((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0))
flag = true;
int m = 1;
switch (1) {
case 1:
if (n <= 31) break;
n -= 31;
m++;
case 2:
if (flag) {
if( n <= 29) break;
n-= 29;
m++;
} else {
if(n <= 28) break;
n -= 28;
m++;
}
case 3:
if (n <= 31) break;
n -= 31;
m++;
case 4:
if (n <= 30) break;
n -= 30;
m++;
case 5:
if (n <= 31) break;
n -= 31;
m++;
case 6:
if (n <= 30) break;
n -= 30;
m++;
case 7:
if (n <= 31) break;
n -= 31;
m++;
case 8:
if (n <= 31) break;
n -= 31;
m++;
case 9:
if (n <= 30) break;
n -= 30;
m++;
case 10:
if (n <= 31) break;
n -= 31;
m++;
case 11:
if (n <= 30) break;
n -= 30;
m++;
}
// 按照yyyy-mm-dd格式输出日期
cout << y << '-';
if (m < 10) cout << 0;
cout << m << '-';
if (n < 10) cout << 0;
cout << n << endl;
}
return 0;
}