EasyRating 1000
Finishing the Book
A book has n pages. You can read p₁ pages on Monday, p₂ on Tuesday, …, p₇ on Sunday, every week. Starting on a Monday, on which day (1 = Monday … 7 = Sunday) do you read the last page?
Input
n, then seven integers (at least one is positive).
Output
One integer.
Sample 1
Input
100 15 20 20 15 10 30 45
Output
6
Sample 2
Input
2 1 0 0 0 0 0 0
Output
1
Output appears here