n = (int(input())) H = 0 for i in range(n): product = int(input()) H += product if (H >= 1000): break print(H)