Sum of digits
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
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^5
). Next line contains n positive integers. Each number is not greater than 10^9
.
Output
Print the number with minimal sum of digits.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 6K
Acceptance rate 42%