eolymp
bolt
Try our new interface for solving problems
Problems

Sum of digits

Sum of digits

Time limit 1 second
Memory limit 128 MiB

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 data

First line contains n (1n10^5). Next line contains n positive integers. Each number is not greater than 10^9.

Output data

Print the number with minimal sum of digits.

Examples

Input example #1
4
7 8 9 10
Output example #1
10
Input example #2
4
41 32 23 14
Output example #2
14