#include<stdio.h>
bool rn(int n){
if(n%4==0&&n%100!=0||n%400==0){
return 1;
}
else return 0;
}
int main(){
int yy=1777,mm=4,dd=30,ans;
int day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
scanf("%d",&ans);
for(int i=4;i<=11;i++){
ans=ans-day[i];
mm++;
}
ans=ans-2;
yy=1778;
mm=1;
dd=1;
while(ans>=366){
if(rn(yy+1)){ans=ans-366;
yy++;
}
else{ans=ans-365;
yy++;
}
}
while(ans>=day[mm]){
ans=ans-day[mm];
mm++;
if(mm==13){
mm=1;
yy++;
}
}
while(ans){
ans--;
dd++;
if(dd>day[mm]){
dd=0;
mm++;
if(mm==13){
mm=0;
yy++;
}
}
}
printf("%d-",yy);
if(mm<10) printf("0%d-",mm);
else printf("%d-",mm);
printf("%d",dd);
return 0;
}