ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Ural Championship 2015

About     Problems     Submit solution     Judge status     Standings
Contest is over

C. History

Time limit: 1.0 second
Memory limit: 64 MB
Android Vasya likes the history of the ancient world. He likes to read about various superstitions people had at that time.
Recently Vasya came across a superstition concerning his favorite number 13. It turned out, that ancient people considered this number unlucky and avoided it as much as they could:
  • they wouldn't sit at table if there were exactly 13 people;
  • they didn't use number 13 in numbering floors of a building: 12-th floor was followed by 14-th one;
  • they didn't do anything important on Friday the 13-th.
Vasya was especially amused by the superstition about Friday. How could people think that something bad could happen in such a wonderful day like Friday?
Now Vasya makes a research in the ancient world history covering a period from year A till year B. He wonders how many unlucky Fridays this period contains. Help him to cope with this simple task.


The only line contains integers A and B (1919 ≤ AB ≤ 109). Androids use the Gregorian style for chronology. According to it the year is leap if its number is a multiple of 400 or if it is a multiple of 4 but is not a multiple of 100. In the leap years February is extended to 29 days.


For every k from 0 to 12 output how many times in the period from Vasya’s research there was a year with exactly k unlucky Fridays.


2015 2016
0: 0
1: 1
2: 0
3: 1
4: 0
5: 0
6: 0
7: 0
8: 0
9: 0
10: 0
11: 0
12: 0


In 2015 Fridays are February 13, March 13 and November 13, and in 2016 is May 13 only.
Problem Author: Alexander Ipatov (prepared by Oleg Dolgorukov)
Problem Source: Ural Sport Programming Championship 2015
To submit the solution for this problem go to the Problem set: 2048. History