COCI '15 Contest 3 #1 Pot

View as PDF

Submit solution


Points: 5
Time limit: 1.0s
Memory limit: 64M

Problem types

The teacher has sent an e-mail to her students with the following task: "Write a program that will determine and output the value of X if given the statement:

X=number1pot1+number2pot2++numberNpotN

and it holds that number1,number2 to numberN are integers, and pot1,pot2 to potN one-digit integers."

Unfortunately, when the teacher downloaded the task to her computer, the text formatting was lost so the task transformed into a sum of N integers:

X=P1+P2++PN

For example, without text formatting, the original task in the form of X=212+1253 became a task in the form of X=212+1253. Help the teacher by writing a program that will, for given N integers from P1 to PN determine and output the value of X from the original task.

Please note: We know that it holds aN=aaa (N times).

Input Specification

The first line of input contains the integer N (1N10), the number of the addends from the task. Each of the following N lines contains the integer Pi (10Pi9999,i=1N) from the task.

Output Specification

The first and only line of output must contain the value of X (X1000000000) from the original task.

Sample Input 1

Copy
2
212
1253

Sample Output 1

Copy
1953566

Explanation for Sample Output 1

212+1253=441+1953125=1953566.

Sample Input 2

Copy
5
23
17
43
52
22

Sample Output 2

Copy
102

Sample Input 3

Copy
3
213
102
45

Sample Output 3

Copy
10385

Comments

There are no comments at the moment.