#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; auto range(int n) { return views::iota(0, n); } template ostream& operator<<(ostream& os, const pair& p){ return os << "{" << p.first << ", " << p.second << "}"; } template ostream& operator<<(ostream& os, const vector& obj) { os << "{"; for (const auto& e : obj) os << e << ", "; return os << "}"; } template ostream& operator<<(ostream& os, const set& obj) { os << "set{"; for (const auto& e : obj) os << e << ", "; return os << "}"; } template ostream& operator<<(ostream& os, const map& obj) { os << "map{"; for (const auto& e : obj) os << e << ", "; return os << "}"; } #ifdef ONLINE_JUDGE #define dump(expr) ; #else #define dump(expr) { cerr << "\033[33m#L" << __LINE__ << ": " << expr << "\033[39m" << endl; } #endif void solve() { int n; cin >> n; vector vs(n); for (int i : range(n)) cin >> vs[i]; int dmax = min(n, 19); vector sign(dmax); int tot = 0; while (1) { if (sign[0] == 1) tot -= vs[0]; else if (sign[0] == 2) tot -= -vs[0]; sign[0]++; if (sign[0] == 1) tot += vs[0]; else if (sign[0] == 2) tot += -vs[0]; { int j = 0; for (; j < dmax && sign[j] == 3; j++) { sign[j] = 0; if (sign[j + 1] == 1) tot -= vs[j + 1]; else if (sign[j + 1] == 2) tot -= -vs[j + 1]; sign[j + 1]++; if (sign[j + 1] == 1) tot += vs[j + 1]; else if (sign[j + 1] == 2) tot += -vs[j + 1]; } if (sign[dmax - 1] == 2) break; } if (tot == 0) { for (int j : range(dmax)) { if (j) cout << " "; if (sign[j] == 0) cout << 0; if (sign[j] == 1) cout << vs[j]; if (sign[j] == 2) cout << -vs[j]; } for (int j = dmax; j < n; ++j) cout << " 0"; cout << endl; return; } } cout << "No" << endl; } int main() { cout << fixed << setprecision(12); solve(); }