#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;

ld const PI = 4*atan((ld)1);

int main()
{
	fastio;

	int n;
	cin >> n;

	vector<ll> a(n), b(n);
	for (ll &x : a)
		cin >> x;

	for (ll &x : b)
		cin >> x;

	ll ma = 0, res = 0;
	for (int i = 0; i < n; ++i)
	{
		ma = max(ma, a[i]);
		res = max(res, ma * b[i]);

		cout << res << '\n';
	}

	return 0;
}

// Artur Kraska, II UWr

#include <bits/stdc++.h>

#define forr(i, n)                  for(int i=0; i<n; i++)
#define FOREACH(iter, coll)         for(auto iter = coll.begin(); iter != coll.end(); ++iter)
#define FOREACHR(iter, coll)        for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter)
#define lbound(P,R,PRED)            ({typeof(P) X=P,RRR=(R), PPP = P; while(PPP<RRR) {X = (PPP+(RRR-PPP)/2); if(PRED) RRR = X; else PPP = X+1;} PPP;})
#define testy()                     int _tests; scanf("%d", &_tests); FOR(_test, 1, _tests)
#define CLEAR(tab)                  memset(tab, 0, sizeof(tab))
#define CONTAIN(el, coll)           (coll.find(el) != coll.end())
#define FOR(i, a, b)                for(int i=a; i<=b; i++)
#define FORD(i, a, b)               for(int i=a; i>=b; i--)
#define MP                          make_pair
#define PB                          push_back
#define ff                          first
#define ss                          second
#define deb(X)                      X;

#define M 1000000007
#define INF 1000000007LL

using namespace std;

int n, m, a;
long long t1[1000007], t2[1000007], m1[1000007];

int main()
{
    scanf("%d", &n);
    FOR(i, 1, n)
    {
        scanf("%lld", &t1[i]);
        m1[i] = max(m1[i-1], t1[i]);
    }
    long long res = 0;
    FOR(i, 1, n)
    {
        scanf("%lld", &t2[i]);
        res = max(res, t2[i]*m1[i]);
        printf("%lld\n", res);
    }

    return 0;
}
