import sys arr = list(map(int, sys.stdin.read().split())) sum = 0 for i in range(1, len(arr)): sum += arr[i] if sum >= 1000: print(sum) break