This page is still under construction.

Parts of this page are still being built. What you see may change.

Math Tutoring

Time limit1sMemory limit128 MB

Summary
Read each polynomial's degree and coefficients and print the coefficients of its derivative in the same format.
Level

Easy1 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

You are teaching a friend the rule for differentiating a polynomial, and no matter how many examples you work through, the rule does not stick. So you decide to write a program that computes the derivative for him.

Differentiating the polynomial

anxn+an−1xn−1+⋯+a2x2+a1x+a0a_n x^n + a_{n-1} x^{n-1} + \dots + a_2 x^2 + a_1 x + a_0

gives

nanxn−1+(n−1)an−1xn−2+⋯+2a2x+a1n a_n x^{n-1} + (n-1) a_{n-1} x^{n-2} + \dots + 2 a_2 x + a_1

For example, the derivative of 2x3−x+32x^3 - x + 3 is 6x2−16x^2 - 1, and the derivative of 3x4+2x3+7x2+5x+73x^4 + 2x^3 + 7x^2 + 5x + 7 is 12x3+6x2+14x+512x^3 + 6x^2 + 14x + 5.

Given a polynomial, print its derivative. Only polynomials of the form shown above appear in this problem.

Input

The first line contains the number of test cases.

Each test case is given on a single line. The first integer on the line is the highest exponent nn (1≤n≤1001 \le n \le 100) of the polynomial, followed by n+1n+1 coefficients, one for each term from xnx^n down to x0x^0. Every coefficient is an integer between −1000-1000 and 10001000, inclusive. The highest exponent is always positive. All numbers are separated by a single space.

Output

Print one line for each test case. The line starts with Case x:, where xx is the test case number counting from 1. Put a single space after the colon and then write the derivative.

Write the derivative in the same format as the input. The first value is the highest exponent n−1n-1 of the derivative, followed by its nn coefficients from xn−1x^{n-1} down to x0x^0. Separate the values with a single space, and print the leading coefficient even when it is 0.

Examples1

  1. Example 1

    Input
    4
    3 2 0 -1 3
    4 3 2 7 5 7
    5 6 5 4 3 2 1
    1 5 10
    
    Expected output
    Case 1: 2 6 0 -1
    Case 2: 3 12 6 14 5
    Case 3: 4 30 20 12 6 2
    Case 4: 0 5