k = int(input()) res = 0 for i in range(k): if res < 1000: res += int(input()) print(res)