#include using namespace std; int main() { int64_t n; cin >> n; int64_t x[n]; for(int i = 0; i < n; ++i) cin >> x[i]; int64_t y[n]; for(int i = 0; i < n; ++i) cin >> y[i]; const int64_t INF = 1e18; int64_t dmax = INF; for(int i = 0; i < n; ++i) { dmax = min(dmax, x[i] + y[i]); } cout << dmax << '\n'; cout << 0 << '\n'; for(int i = 0; i < n; ++i) { if(x[i] < y[i]) { cout << min(x[i], dmax) << '\n'; } else { cout << max(0, dmax - y[i]) << '\n'; } } cout << dmax << '\n'; return 0; }