#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "<>n; vi x(n),y(n); REP(i,n) cin>>x[i]; REP(i,n) cin>>y[i]; int mx = 0; int mn = 10e6; int mnidx = 0; REP(i,n){ if(mn > x[i]+y[i]){ mn = x[i]+y[i]; mnidx = i; } } cout << mn << endl; cout << "0" << endl; REP(i,n){ int dist = 0; if(i==mnidx) dist = x[i]; else if(x[i]>y[i]){ dist = max(0, mn-y[i]); }else dist = x[i]; cout << dist << endl; } cout << mn << endl; return 0; }