#include<iostream> #include<cstdio> using namespace std; int main() { int y, m, d, n; int a[2][12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int flag;//闰年的标志 int sum; while (cin >> y >> n) { if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)flag = 1; else flag = 0; sum = 0; m = 0; while ((sum + a[flag][m]) < n) { sum += a[flag][m]; m++; } m++; d = n - sum; printf("%04d-%02d-%02d\n", y, m, d); } return 0; }