import java.util.*;
class convert
{
int n,d,m,y;
convert()
{
n=0;
d=0;
m=0;
y=0;
}
void accept()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter day number");
n=s.nextInt();
System.out.println("Enter year");
y=s.nextInt();
}
void day_to_date()
{
int arr[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i,sum=0;
if (y%4==0)
arr[2]=29;
for (i=1;i<=12;i++)
{
sum=sum+arr[i];
if (sum>=n)
break;
}
d=arr[i]-(sum-n);
m=i;
}
void display()
{
String str[]={"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
System.out.println(str[m]+" "+d+","+y);
}
public static void main()
{
convert obj=new convert();
obj.accept();
obj.day_to_date();
obj.display();
}
}