from itertools import accumulate T=list(map(int,input().split())) RT=list(accumulate(T)) MT=[] f=0 for _ in range(7): if f==1: MT.append(-1) else: if T[_]==-1: f=1 MT.append(0) else: MT.append(0) # print(RT) for i in range(7): if MT[i]==-1: print(-1) elif 6000-RT[i]>=0: print(6000-RT[i]) else: print(-1)