#include <bits/stdc++.h> using namespace std; const int months[]={ 0,31,28,31,30,31,30,31,31,30,31,30,31 }; int is_leap(int year){ if((year%4==0 && year%100!=0) || year%400 == 0){ return 1; } return 0; } int get_days(int year, int month){ int res = months[month]; if (month == 2){ res += is_leap(year); } return res; } int main(){ int year, d; while (cin >> year >> d){ for (int i=1; i<=12; i++){ if (d <= get_days(year, i)){ printf("%04d-%02d-%02d\n", year, i, d); break; } else{ d = d - get_days(year, i); } } } return 0; }