t=list(map(int,input().split())) now=6000 ans=[] T=False for i in range(7): if t[i]==-1: T=True else: now-=t[i] if now<0: T=True if T: ans.append(-1) else: ans.append(now) for i in ans: print(i)