N=int(input())
n=[]
for i in range(N):
  A=int(input())
  n.append(A)
ans=0
i=0
while ans<1000:
  ans+=n[i]
  i+=1
print(ans)