#### Examples.

- Input:
  dayofweek(1,10,2014)
  Output:

  3

  This means that 1 October, 2014 was a Wednesday.
- Input:
  dayofweek(15,10,1582)
  Output:

  5

  This indicates that 15 October 1582 was on a Friday.

The Gregorian calendar, the calendar used by most of the world, was introduced on 15 October 1582. Before that, the Julian calendar was used, which had a leap year every four years and so used years with an average of 365.25, which is slightly off from the actual value of about 365.242 days. To deal with this, the Gregorian calendar was introduced, where a leap year is a year which is divisible by 4, but not divisible by 100 unless it is also divisible by 400. This gives an average length of year that is accurate to within 1 day every 3000 years.

Many countries switched from the Julian calendar to the Gregorian calendar after 4 October 1582 in the Julian calendar, and the next day was 15 October 1582.