#include <iostream>
using namespace std;
int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main() {
    int a, b;
    while (cin >> a >> b) { // 注意 while 处理多个 case
        if((a%400==0)||(a%4==0&&a%100!=0)){
            days[2]=29;
        }else{
            days[2]=28;
        }
        int month = 1;
        while(b>days[month]){
            b-=days[month];
            ++month;
        }
        printf("%4d-%02d-%02d\n",a,month,b);
    }
}
// 64 位输出请用 printf("%lld")

优雅又简洁