From the counts of months, days per month, and days per week, compute the number of rows the year calendar occupies under the layout rules.
Medium5MathSimulationNo attempts yetTime limit5sMemory limit512 MBThe newly found planet ELG8-G outside the solar system rotates and orbits on a different schedule from Earth, so Earth's calendar does not fit it. Scientists decided to build a new calendar system for the planet. The Gregorian calendar used on Earth is awkward because the number of days differs from month to month, so in the new system every month has the same number of days.
The scientists want to print a large calendar for writing down daily observations. The size of that calendar depends on how many months make up a year and how many days make up a week. Write a program that reads those numbers and prints how many rows the calendar needs.
The calendar is printed by these rules.
With 11 days in a month, 3 months in a year, and 4 days in a week, the calendar takes 11 rows.
| #0 | #1 | #2 | #3 |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | |
| 1 | |||
| 2 | 3 | 4 | 5 |
| 6 | 7 | 8 | 9 |
| 10 | 11 | ||
| 1 | 2 | ||
| 3 | 4 | 5 | 6 |
| 7 | 8 | 9 | 10 |
| 11 |
The first line contains the number of test cases T. Each of the next T lines holds one test case as three natural numbers separated by spaces.
M D W
M is the number of months in a year, D is the number of days in a month, and W is the number of days in a week.
For each test case, print one line in the form Case #x: y. Here x is the case number starting from 1, and y is the number of rows the calendar needs.