#P7226. [COCI 2015/2016 #3] POT
[COCI 2015/2016 #3] POT
Description
The teacher sent an email to the students with the following task.
Write a program that, given numbers, outputs .
$$X = num_1^{p_1} + num_2^{p_2} + \cdots + num_n^{p_n}$$, , , are all integers, and , , , are all one-digit numbers.
However, due to some mysterious errors, became:
Note: .
For example, the original is , but now it becomes . Please help the teacher write a program to output the original value of .
Input Format
The first line contains a positive integer .
The next lines each contain an integer .
Output Format
Print one integer on a single line: the value of .
2
212
1253
1953566
5
23
17
43
52
22
102
3
213
102
45
10385
Hint
Constraints
For of the testdata, , , .
Notes
Translated from COCI 2015-2016 #3 A POT, full score 50.
Translated by ChatGPT 5
京公网安备 11011102002149号