#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 nn numbers, outputs XX.

$$X = num_1^{p_1} + num_2^{p_2} + \cdots + num_n^{p_n}$$

num1num_1, num2num_2, \cdots, numnnum_n are all integers, and p1p_1, p2p_2, \cdots, pnp_n are all one-digit numbers.

However, due to some mysterious errors, XX became:

X=q1+q2+...+qnX = q_1 + q_2 +... + q_n

Note: qi=numi×10+piq_i = num_i \times 10 + p_i.

For example, the original XX is 212+125321^2 + 125^3, but now it becomes 212+1253212 + 1253. Please help the teacher write a program to output the original value of XX.

Input Format

The first line contains a positive integer nn.

The next nn lines each contain an integer qiq_i.

Output Format

Print one integer on a single line: the value of XX.

2
212
1253

1953566
5
23
17
43
52
22

102
3
213
102
45

10385

Hint

Constraints

For 100%100\% of the testdata, 1n101 \le n \le 10, 10qi9.999×10310 \le q_i \le 9.999 \times 10 ^ 3, 1X1091 \leq X \leq 10 ^ 9.

Notes

Translated from COCI 2015-2016 #3 A POT, full score 50.

Translated by ChatGPT 5