y=1970,m=1,d=1;
main(n){
for(scanf("%d",&n
);n
--;)(d
=++d
%(m
^2?m
^4&&m
^6&&m
^9&&m
^11?32:31:(y
%4|!(y
%100))&y
%400?29:30))||(++d
,m
=++m
%13)||++m
*++y
; }
eT0xOTcwLG09MSxkPTE7CgptYWluKG4pewogIGZvcihzY2FuZigiJWQiLCZuKTtuLS07KShkPSsrZCUobV4yP21eNCYmbV42JiZtXjkmJm1eMTE/MzI6MzE6KHklNHwhKHklMTAwKSkmeSU0MDA/Mjk6MzApKXx8KCsrZCxtPSsrbSUxMyl8fCsrbSorK3k7CiAgcHJpbnRmKCIlZC8lZC8lZFxuIix5LG0sZCk7Cn0=