找规律题,最终可以简化为一个式子

  How Many Points of Intersection? 

a dots on the top row and b dots on the bottom row. We draw line segments connecting every dot on the top row with every dot on the bottom row. The dots are arranged in such a way that the number of internal intersections among the line segments is maximized. To achieve this goal we must not allow more than two line segments to intersect in a point. The intersection points on the top row and the bottom are not included in our count; we can allow more than two line segments to intersect on those two rows. Given the value of a and b, your task is to compute P(ab), the number of intersections in between the two rows. For example, in the following figure a = 2 and b = 3. This figure illustrates that P(2, 3) = 3.


Input 

a ( 0 < a20000) and b ( 0 < b20000). Input is terminated by a line where botha and b

Output 

P(ab). Look at the output for sample input for details. You can assume that the output for the test cases will fit in 64-bit signed integers.

Sample Input 


2 22 3 3 3 0 0


Sample Output 


Case 1: 1Case 2: 3 Case 3: 9



12 3 4 5 6 7 8 9 10 11 12 13


#include <stdio.h>
int main()
{
    long long a, b, s, i, j, n = 0;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        n++;
        s = 0;
        if(a==0&&b==0) break;
        printf("Case %lld: %lld\n", n, (a - 1) * a / 2 * (b - 1) * b / 2);
    }
    return 0;
}