All problems

When Does Cumulative Revenue Cross $1000?

hardPythonNumPynp.cumsum

Riverbend Supply pays its market-stall traders a bonus once the stall's takings for the month reach $1,000 in total. The trader wants to know which day of the month tipped them over, so the office reports the position of the day on which the month's takings so far first stood at $1,000 or more. Exactly $1,000 counts — it reaches the target. Every stall in the data does reach it at some point during the month.

Task: Print the position of the day on which the takings so far first reached the target.

Input

The first line holds a single integer n, the number of days. Each of the next n lines holds one day's takings, which may carry decimals. The month's takings are guaranteed to reach $1,000 at some point.

Output

One line holding that day's position, counted from 0: the first day of the month sits at position 0, not position 1.

Example:

Input:
5
300
300
300
300
300

Output:
3

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…