n = int(input()) remains = 1000 while remains > 0: remains -= int(input()) print(abs(remains) + 1000)