n = int(input())
s = 0

while (s < 1000) and (n > 0):
    s += int(input())
    n -= 1

print(s)