s = 0
for _ in range(0, int(input())):
	s += int(input())
	if s >= 1000:
		print(s)
		exit()