#C7602. Magical Potential of a Stone
Magical Potential of a Stone
Magical Potential of a Stone
Given a non-negative integer representing a stone, compute its magical potential. The magical potential is defined as the sum of its digits raised to successive powers starting from 1. Formally, for a stone with digits \(d_1d_2\ldots d_n\), the magical potential is given by:
$$\sum_{i=1}^{n} d_i^{i}$$
where \(d_i\) is the i-th digit (from left to right) and \(n\) is the number of digits.
inputFormat
The input is provided via stdin. The first line contains an integer \(T\), the number of test cases. Each of the following \(T\) lines contains a non-negative integer representing a stone.
outputFormat
For each test case, output one line to stdout containing the magical potential of the stone.
## sample3
123
456
789
32
245
800
</p>