n = int(input()) count = 0 for i in range(n): b = int(input()) if count >= 1000: break else: count += b print(count)