#arc153d. [arc153_d]Sum of Sum of Digits
[arc153_d]Sum of Sum of Digits
Problem Statement
For a positive integer , let denote the sum of its digits. For instance, we have , , and .
You are given a sequence of positive integers . Find the minimum possible value of where is a non-negative integer.
Constraints
Input
The input is given from Standard Input in the following format:
Output
Print the minimum possible value of where is a non-negative integer.
Sample Input 1
4
4 13 8 6
Sample Output 1
14
For instance, makes $\\sum_{i=1}^N f(A_i+x) = f(11) + f(20) + f(15) + f(13) = 14$.
Sample Input 2
4
123 45 678 90
Sample Output 2
34
For instance, makes $\\sum_{i=1}^N f(A_i+x) = f(145) + f(67) + f(700) + f(112) = 34$.
Sample Input 3
3
1 10 100
Sample Output 3
3
For instance, makes .
Sample Input 4
1
153153153
Sample Output 4
1
For instance, makes .