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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll n, ans=0;
	cin >> n;
	ll maxa=0, x, y; 
	vector<ll> a, b;
	rep(i, n){
		cin >> x;
		a.push_back(x);
	}
	rep(i, n){
		cin >> x;
		b.push_back(x);
	}

	rep(i, n){
		chmax(maxa, a[i]);
		chmax(ans, maxa*b[i]);
		cout << ans << endl;
	}
	return 0;
}

///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           nd(a,b,c)                   mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=2e18;
const int mod=1e9+7;
const int M=200005;
int a[M],b[M],n;
 main()

{
    fast
    cin>>n;
    f(i,1,n)
    {
        cin>>a[i];
    }
    f(i,1,n)
    {
        cin>>b[i];
    }
    int ses=0,mx=0;
    f(i,1,n)
    {
        mx=max(mx,a[i]);
        ses=max(ses,mx*b[i]);
        cout<<ses<<"\n";
    }
    return 0;

}



































