#include <iostream>
using namespace std;

void nextDay(int &year,int & startMonth,int & startDay) {
	// 每个月份的天数数组
	int dayOfMonth[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
	// 是否闰年判断条件
	bool isLeap = year % 400 == 0 || year % 4 == 0 && year % 100 != 0;
	if (isLeap) {
		dayOfMonth[2] = 29;  // 闰年2月多一天
	}
	startDay++;
	if (startDay >dayOfMonth[startMonth]) {
		startDay = 1;
		startMonth++;
	}
	if (startMonth > 12) {
		startMonth = 1;
		year++;
	}
}

int main() {
	int year, startMonth, startDay, n;
	while (cin >> year >> n) {
		startMonth = 1, startDay = 1;
		while(n > 1) {
			nextDay(year, startMonth, startDay);
			n--;
		}
		if (startMonth <= 9 && startDay <= 9) {
			cout << year << "-0" << startMonth << "-0" << startDay << endl;
		}else if (startDay <= 9) {
			cout << year << "-" << startMonth << "-0" << startDay << endl;
		}else if (startMonth <= 9) {
			cout << year << "-0" << startMonth << "-" << startDay << endl;
		}
		else {
			cout << year << "-" << startMonth << "-" << startDay << endl;
		}
		
	}
	return 0;
}