100 atcoder#ABC220C. [ABC220C] Long Sequence
[ABC220C] Long Sequence
Score : points
Problem Statement
We have a sequence of positive integers: . Let be the concatenation of copies of .
Consider summing up the terms of from left to right. When does the sum exceed for the first time? In other words, find the minimum integer such that:
.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3
3 5 2
26
8
We have . holds, but the condition is not satisfied when is or less, so the answer is .
4
12 34 56 78
1000
23