using namespace std;
#include<string>
#include<cmath>
#include<list>
#include <map>
#include <unordered_map>
#include <set>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ml map<ll,ll>
#define pb push_back
#define mp make_pair
#define ppl pair<ll,ll>
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e9 + 7;
#include<iterator>
#define EPSILON numeric_limits<double>::epsilon()



// vl b;
// vector<vl> v;
// ll n, m;
// vl link, val;
// vector<char>a;
// vector<bool> visited;

// void dfs(ll pnt, ll lin) {
// 	link[pnt] = lin;
// 	visited[pnt] = true;
// 	fr(i, 0, v[pnt].size()) {
// 		if (!visited[v[pnt][i]])dfs(v[pnt][i], lin);
// 	}
// }

// vl pr(N, 0);

// void precompute() {
// 	pr[1] = 1;
// 	fr(i, 2, N + 1) {
// 		ll d = i, g = 0;
// 		while (d > 0) {
// 			if (d % 10 == 7) {g = 1; break;}
// 			d /= 10;
// 		}
// 		if (g) {pr[i] = pr[i - 1]; continue;}
// 		d = i;
// 		while (d > 0) {
// 			if (d % 8 == 7) {g = 1; break;}
// 			d /= 8;
// 		}
// 		if (g) {pr[i] = pr[i - 1]; continue;}
// 		else pr[i] = pr[i - 1] + 1;
// 	}
// }

// void prime() {
// 	pr[1] = 1;
// 	fr(i, 2, N + 1)pr[i] = i;
// 	fr(i, 4, N + 1) {pr[i] = 2; i++;}
// 	fr(i, 3, N + 1) {
// 		if (pr[i] == i) {
// 			for (ll j = i * i; j <= N; j += i) {if (pr[j] == j)pr[j] = i;}
// 		}
// 	}
// }

ll gcd(ll a, ll b) {
	if (a == b)return a;
	if (a % b == 0)return b;
	if (b % a == 0)return a;
	if (b > a)return gcd(a, b % a);
	if (a > b)return gcd(a % b, b);
	return 0;
}


// ll fact(ll n) {
// 	ll res = 1;
// 	fr (i, 2, n + 1) res = (res * i) % N;
// 	return res;
// }

// ll nCr(ll n, ll r) {
// 	return fact(n) / (fact(r) * fact(n - r));
// }



void solve() {
	ll n; cin >> n;
	ll a[n], b[n], ma = 0, maxi = 0, prev = 0;
	fr(i, 0, n)cin >> a[i];
	fr(i, 0, n)cin >> b[i];
	fr(i, 0, n) {
		if (a[i] > ma) {
			ma = a[i];
			maxi = 0;
		}
		maxi = max(maxi, b[i]);
		cout << max(prev, maxi * ma) << '\n';
		prev = max(maxi * ma, prev);
	}
}




int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif
	// prime();
	// precompute();
	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		//cout << "Case #" << h << ": ";
		solve();
		//h++;
		cout << '\n';
	}
	return 0;
}
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

const int N = 200010;

LL a[N], b[N];
long long c[N];

int main() {
    int n;
    cin >> n;

    for (int i = 0; i < n; i ++)    scanf("%d", &a[i]);
    for (int i = 0; i < n; i ++)    scanf("%d", &b[i]);

    LL res = 0, maxd = 0;
    res = c[0] = a[0] * b[0];
    maxd = a[0];
    for (int i = 1; i < n; i ++) {
        maxd = max(a[i], maxd);
        if (maxd * b[i] > res) {
            c[i] = res = maxd * b[i];
        }
        else c[i] = res;
    }

    for (int i = 0; i < n; i ++)    printf("%lld\n", c[i]);
    return 0;
}
