#include using namespace std; const int inf = 1 << 30; int main() { int N; cin >> N; vector< int > X(N), Y(N); for(auto &x : X) cin >> x; for(auto &y : Y) cin >> y; int ret = inf; for(int i = 0; i < N; i++) { ret = min(ret, X[i] + Y[i]); } cout << ret << endl; cout << 0 << endl; for(int i = 0; i < N; i++) { int need = X[i] + Y[i] - ret; cout << X[i] - min(X[i], need) << endl; } cout << ret << endl; }