#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
#define INF 3000000000000001 // 3e15
#define ll_max 9000000000000000000
#define PI 3.14159265358979323846L
#define fill(a, n, x) for(int i = 0; i < n; i++) a[i] = x;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll N = 100100;
const ll M = log2(N) + 1;

struct point
{
    ll x, y;
};

template<typename T>
T fast_exp(T x,T n)
{
    if(n == 0) return 1;
    T ans = 1;
    if(n % 2 == 0)
    {
         ans = fast_exp(x, n / 2);
         ans = ans * ans % mod;
    }
    else ans = fast_exp(x, n - 1) * x % mod;
    return ans;
}

struct node {
    int vertex;
    bool mx;
    bool mn;
    node(int v, bool a, bool b)
    {
        vertex = v;
        mx = a;
        mn = b;
    }
};

struct cmp {
    bool operator () (pair<ll, node> a, pair<ll, node> b)
    {
        if(a.ff < b.ff)
            return 1;
        return 0;
    }
};

ll fact[N], infact[N];
void work()
{
    fact[0] = fact[1] = infact[0] = infact[1] = 1;
    for(ll i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i % mod;
        infact[i] = fast_exp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    return fact[n] * infact[n - r] % mod * infact[r] % mod;
}


int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    work();
    int test = 0;
    while(_--)
    {
        test++;
        ll n, m, q, x = 0, y = 0, ans = 0, k = 0;
        cin >> n;
        x = 0, y = 0;
        ll a[n + 1], b[n + 1];
        a[0] = 0;
        for(int i = 1; i <= n; i++) cin >> a[i];
        for(int i = 1; i <= n; i++) cin >> b[i];
        for(int i = 1; i <= n; i++)
        {
            a[i] = max(a[i - 1], a[i]);
            ans = max(a[i] * b[i], ans);
            cout << ans << "\n";
        }
    }
    return 0;
}

//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7,MAX = 1e6+5;
const ll INF = 1e18+5;

int main()
{
	int n;
	cin>>n;
	vi A(n),B(n);
	take(A,0,n);
	take(B,0,n);
	int maxA = 0;
	ll maxAB = 0;
	for(int i=0;i<n;i++)
	{
		maxA = max(maxA,A[i]);
		maxAB = max(maxAB,(ll)B[i]*maxA);
		cout<<maxAB<<endl;
	}
}	