My Best Friend
题号:NC15846
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

The End Of The Circle · Kaname Madoka wants to destroy the civilization of Incubator. First of all, she needs some mahoushoujyo who have the VIRTUE. Here is the way we judge a month is VIRTUE or FELLAH,  a month is called VIRTUE if the first day and the last day in this month is Saturday or Sunday. A month is called FELLAH if the first day and the last day in this month is weekday. If a month is "VIRTUE month", the VIRTUE value is +10. If a month is "FELLAH month", the VIRTUE value is -1. In other cases, the VIRTUE value is 0.  The VIRTUE value of a mahoushoujyo is the sum of the VIRTUE value of every month from she becomes a  mahoushoujyo to she becomes a majyo. A mahoushoujyo is called Righteous if her VIRTUE value is bigger then 0mahoushoujyo is called Fellah if her VIRTUE value is less then 0 or equal to 0. mahoushoujyo maybe Homura if her VIRTUE value is the biggest of the input data.

The following is the formula for the Gregorian calendar to determine whether an year is a leap year or not. An year y, y > 1582 and y ≠ 1700, is a leap year if and only if

  • y is divisible by 4, and

  • y is not divisible by 100 unless it is divisible by 400.

An year y, 0 < y < 1582 is a leap year if and only if

  • y is divisible by 4.
During your computation, you may also want to observe the following facts about Gregorian calendar. Many calendar systems were used by people in different areas in the Western world at the same time. The current Western calendar system, primarily follows Gregorian calendar, and is so called the Gregorian Reformation, was adopted by Britain and the possessions on September 3, 1752. For lots of reasons that we are sure you do not want to read in this problem description, 11 days are eliminated starting September 3, 1752 in order for people not to rewrite history. That is, in the Gregorian calendar, there is no days in between September 3, 1752 and September 13, 1752. Note that Rome adopted the Gregorian calendar at the year 1582, when it was invented. Also for historical reasons, the year 1700 is declared a leap year in the Gregorian calendar. There are other variations about the Gregorian calendar system, however, we will use the one that is defined above.








输入描述:

Every line is a string looks like "Ys/Ms-Ye/Me"

0< Ys < Ye <10000
0< Ms 、 Me  <13
A girl becomes a mahoushoujyo in Ys/Ms
A gril becomes a majyo in Ye/Me
Ys Ms Ye Mare 4 Integers


输出描述:

If all of the mahoushoujyo's VIRTUE value less than 0 or equal to 0, output "All of the mahoushoujyo is Fellah."
Else output the number of Righteous in first line, the order number of mahoushoujyo who have maximum VIRTUE value
示例1

输入

复制
2018/1-2018/1
2018/2-2018/2
2018/3-2018/3
2018/4-2018/4
2018/5-2018/5
2018/6-2018/6
2018/7-2018/7
2018/8-2018/8
2018/9-2018/9
2018/10-2018/10
2018/11-2018/11
2018/12-2018/12
2018/1-2018/12

输出

复制
Thers are(is) 2 Righteous.
9th mahoushoujyo maybe Homura.

说明

9月武德充沛,1/2/5/8/10/11月费拉不堪
示例2

输入

复制
1752/9-1752/9

输出

复制
All of the mahoushoujyo is Fellah.

说明

9月武德值为0

备注:

Hint:
保证使用公元纪年,并且只有A.D.,所有年份均大于等于1且小于等于10000
马猴烧酒的数量小于100,马猴烧酒从变成马猴烧酒到陷入绝望魔女化的时间间隔不超过10年