N = int(input()) max = 1000 count = 0 for i in range(N): count += int(input()) if count >= max: break print(count)