#include <stdio.h>
int main()
{
int db;
int n,y,i,j,mf,c;
scanf("%2d%2d%2d-%d", &n,&y,&i,&db);
db = db/1000000;
if(db==1 || db==2)
{
n += 1900;
}
else // 3, 4
{
n += 2000;
}
if(db==1||db==3)
{
printf("%04d/%02d/%02d M", n,y,i);
}
else
{
printf("%04d/%02d/%02d/ F", n,y,i);
}
}