Tuenti Challenge 8

Challenge 1 - Waffle love

Your store, 20 Waffles, is famous for having the most beautiful and delicious waffles in the entire city. You and your staff have put a lot of effort into making sure the shape of your most requested product, the rectangular waffle, is always perfect and that your customers are always happy with them. Sometimes, they even count the number of holes in your waffles. Sometimes they even ask you for help.

Given each waffle’s number of vertical and horizontal lines, how many holes does it have?

Input

The first line has an integer C, which is the number of cases for the problem. Then C lines follow and each one has two integers N and M, which are the number of vertical and horizontal lines on the waffle.

Output

For each case, there should be a line starting with "Case #x: " followed by the number of holes in the waffle.

Limits

  • 1 ≤ C ≤ 100
  • 2 ≤ N, M ≤ 10000

Sample Input

3
2 2
3 2
4 3

Sample Output

Case #1: 1
Case #2: 2
Case #3: 6

Here are some diagrams for the cases above to help you understand the problem better.

1
2x2
12
3x2
123
456
4x3

Problem stats

Completion time: min: 0:02:22 h
10th percentile: 0:11:08 h
90th percentile: 13:24:14 h
max: 142:26:09 h
Test phase time: 10th percentile: 0:09:09 h
90th percentile: 11:05:42 h
Submit phase time: 10th percentile: 0:00:55 h
90th percentile: 0:21:19 h
# of completions:650