#C13428. Square of Digit Sums

    ID: 42965 Type: Default 1000ms 256MiB

Square of Digit Sums

Square of Digit Sums

Given a list of non-negative integers, for each integer compute the sum of its digits and then output the square of this digit sum. In mathematical terms, for an integer ( n ), let its digit sum be ( S(n) = \sum_{d \in \text{digits of } n} d ). The required output is ( S(n)^2 ) for each integer in the list.

Your program should read the input from standard input (stdin) and write the output to standard output (stdout).

inputFormat

The first line of input contains a single integer ( T ) representing the number of elements. The second line contains ( T ) space-separated non-negative integers.

outputFormat

Output a single line with ( T ) space-separated integers. Each integer is the square of the digit sum of the corresponding input number.## sample

3
1 2 3
1 4 9