Competitions

# Week 8: December 28 - January 10. Functions. Part 1

# Sum of digits

**n** integers are given. Find among them the number with minimal sum of digits (in the case if there are some of them with the same sum – print the last number from the input sequence).

#### Input

First line contains **n** (**1** ≤ **n** ≤ `10`

). Next line contains ^{5}**n** positive integers. Each number is not greater than `10`

.^{9}

#### Output

Print the number with minimal sum of digits.

Input example #1

4 7 8 9 10

Output example #1

10

Input example #2

4 41 32 23 14

Output example #2

14