s = 0 for _ in range(int(input())): s += int(input()) if s < 1000 else 0 print(s)