#include #define rep(i,n) for (int i=0; i < (int)(n); i++) #define all(c) c.begin(), c.end() using namespace std; typedef long long ll; typedef long double ld; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; int main() { ios::sync_with_stdio(0); cin.tie(0); //入出力高速化 int N = 7, M = 6000; int cur = 0; bool ng = false; rep(i,N) { int t; cin>>t; cur += t; if(t == -1) ng = true; if(!ng && cur <= M) cout<<(M-cur)<