#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair P; const int INF = 1e9; int main(){ int n; cin >> n; vector x(n),y(n); int d = INF; rep(i,n) cin >> x[i]; rep(i,n) cin >> y[i]; rep(i,n) d = min(d,x[i] + y[i]); cout << d << endl; cout << 0 << endl; rep(i,n) { if (x[i] <= d) cout << x[i] << endl; else if (y[i] <= d) cout << d - y[i] << endl; else cout << d << endl; } cout << d << endl; return 0; }