#include using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) int main() { ll ans = 6000; bool f = false; rep(i, 7) { ll t; cin >> t; if (f || t == -1) cout << -1 << endl, f = true; else { ans -= t; cout << max(-1LL, ans) << endl; } } return 0; }