#C9908. Powered Sum and Exponentiation
Powered Sum and Exponentiation
Powered Sum and Exponentiation
You are given a list of non-negative integers \(a_0, a_1, \ldots, a_{n-1}\). Your task is to:
- Compute the sum \(S = \sum_{i=0}^{n-1} a_i\).
- Generate a list \(P\) where each element \(P[i] = a_i^{i}\) (with 0-based indexing, note that for any \(a_i\), \(a_i^0 = 1\)).
Input Format: The first line contains an integer \(n\) representing the number of elements. The second line contains \(n\) space-separated non-negative integers.
Output Format: The first line should contain the computed sum \(S\). The second line should contain the \(n\) elements of the list \(P\) separated by a single space.
Note: All operations are guaranteed to use small integers such that overflow is not a concern.
inputFormat
The input is read from standard input. The first line contains an integer \(n\) (the number of elements). The second line contains \(n\) space-separated non-negative integers.
outputFormat
Output the sum \(S\) on the first line and the list \(P\) (with each element \(a_i^{i}\)) on the second line, separated by spaces.
## sample3
2 3 4
9
1 3 16
</p>