/*
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello world!\n");
return 0;
}
*/
/*
#include <stdio.h>
int a[101];
int n,i,j,t;
int main()
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<n;i++)
{
for(j=1;j<=n-i;j++)
{
if(a[j]<a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
for(i=1;i<=n;i++)
printf("%d ",a[i]);
return 0;
}
*/
/*
#include <stdio.h>
int a[1001];
int n,i,j,t,rec;
int main()
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<n;i++)
{
rec=0;
for(j=1;j<=n-i;j++)
{
if(a[j]>a[j+1])
{
rec=1;
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
if(rec==0)
{
break;
}
}
printf("%d",i-1);
}
#include <stdio.h>
int a[100001];
int t;
void quick_sort(int s, int e)
{
int pivot=s, low=s, high=e+1;
if(s>=e) return ;
do
{
do
{
low++;
}while(a[pivot]>a[low]);
do
{
high--;
}while(a[pivot]<a[high]);
if(low < high)
{
t=a[low];
a[low]=a[high];
a[high]=t;
}
}while(low<high);
t=a[high];
a[high]=a[pivot];
a[pivot]=t;
quick_sort(s,high-1);
quick_sort(high+1,e);
}
int main()
{
int n,i,t;
scanf("%d",&n);
for(i=1; i<=n; i++)
{
scanf("%d",&a[i]);
}
quick_sort(1,n);
for(i=1;i<=n;i++)
printf("%d\n",a[i]);
return 0;
}
*/
#include<stdio.h>
int main()
{
int a,b,n;
scanf("%d-%d",&a,&b);
b=b/1000000;
if(b==1 || b==2)
{
printf("%04d/",a/10000+1900);
}
else
{
printf("%04d/",a/10000+2000);
}
n=a/100;
printf("%02d/%02d ",n%100,a%100);
if(b==1 || b==3)
{
printf("M");
}
else
{
printf("F");
}
return 0;
}