LearnPy Hub
← Arena
IntermediateRating 1100

Balance Point

Print the first index i where the sum of elements left of i equals the sum right of i, or -1.

Input

n, then n integers.

Output

An index.

Sample 1

Input
7
-7 1 5 2 -4 3 0
Output
3

Sample 2

Input
3
1 2 3
Output
-1
solution.py
Output appears here
Balance Point · Python Arena problem · LearnPy Hub