#include using namespace std; int main(){ int n; cin >> n; assert(1 <= n && n <= 200000); vector x(n), y(n); for(int i = 0; i < n; i++){ cin >> x[i]; assert(0 <= x[i] && x[i] <= 1000000); } for(int i = 0; i < n; i++){ cin >> y[i]; assert(0 <= y[i] && y[i] <= 1000000); } int MIN = x[0] + y[0]; for(int i = 1; i < n; i++) MIN = min(MIN, x[i] + y[i]); cout << MIN << endl << 0 << endl; for(int i = 0; i < n; i++) cout << max(min(x[i], MIN - y[i]), 0) << endl; cout << MIN << endl; }