atcoder#ARC153D. [ARC153D] Sum of Sum of Digits
[ARC153D] Sum of Sum of Digits
Score : points
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.
4
4 13 8 6
14
For instance, makes $\sum_{i=1}^N f(A_i+x) = f(11) + f(20) + f(15) + f(13) = 14$.
4
123 45 678 90
34
For instance, makes $\sum_{i=1}^N f(A_i+x) = f(145) + f(67) + f(700) + f(112) = 34$.
3
1 10 100
3
For instance, makes .
1
153153153
1
For instance, makes .