Problems
10104 - (a + b)^n
SUBMIT PROBLEM

(a + b)^n

Time Limit: 1 sec

 

The Problem

SmruS likes mathematics a lot. He is reading Algebraic formula. Today’s his topic power of (a+b). Here his written formulas

 

(a+b)^1 = a+b

(a+b)^2 = a^2+2*a*b+b^2

(a+b)^3 = a^3+3*a^2*b+3*a*b^2+b^3

And so on.

[Note: Here ^ sign denoted the power sign.]

 

Now it is so difficult for him when the power is greater than 3. So, can you please write a program for him which take an integer number as input which is  the value of power and print the formula as output.

 

The Input

There is a number of tests T (0< T ≤ 100) on the first line. After T test follows. Each test case take a positive integer number n which the value of the power of (a+b) (0 ≤ n ≤ 50).

 

The Output

For each test output a single line “Case X: F”. Where X is the test case number (starting from 1 to T) and F is an formula of (a+b)^n (see sample output for clarification).

 

Sample Input

3

2

3

1

 

Sample Output

Case 1: a^2+2*a*b+b^2

Case 2: a^3+3*a^2*b+3*a*b^2+b^3

Case 3: a+b

 

 

 

[University Level]

ISCPC 2017 Preliminary

Problem Setter: Shahin ShamS