#!/bin/python3

import math
import os
import random
import re
import sys


year = int(input().strip())
days = 243
x ="no"
if year>=1919:
    if year%4==0 and year%100!=0:
        days = days+1
        
if year>=1919 and year%400==0:
    days = days+1
           
if year<1918 :
    if year%4==0:
        days = days+1
        x ="leap"


d =  256 - days
month= int((days/30)+1)
if month<10:
    mo = "0"+str(month)
if year==1918:
    d = d+13
z =str(d)
y = str(year)
m = "." +mo+"."
date =  z+m+y



print(date)




    