#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
using namespace std ;
typedef long long ll ;
const int mod=1000000007;
const int N=1e3 ;

ll max_ll(const ll &a,const ll &b){
	if(a>b)
		return a ;
	else
		return b ;
}

void solve(){

	int n;
	cin>>n; 

	vector<ll> a(n),b(n) ;

	rep(i,n){
		cin>>a[i] ;
	}

	rep(i,n){
		cin>>b[i] ;
	}

	ll ma=a[0] ;
	vector<ll> c(n) ;
	c[0]=a[0]*b[0] ;

	for(int i=1;i<n;i++){
		ma=max_ll(ma,a[i]) ;
		c[i]=max_ll(c[i-1],ma*b[i]) ;
	}

	for(int i=0;i<n;i++){
		cout<<c[i]<<"\n" ;
	}

	
	

}	

int main(){
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin) ;
		freopen("output.txt","w",stdout) ;
    #endif 

		cin.tie(0);
		cout.tie(0);
		ios_base::sync_with_stdio(false);  

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){
 
			solve() ;
			
		}

		return 0 ;
}
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

ll max(ll a, ll b)
{
    if (a>b)
        return a;
    return b;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,x;
    cin>>n;
    ll a[n],ans=0;
    cin>>a[0];
    for (int i=1;i<n;++i)
    {
        cin>>a[i];
        a[i]=max(a[i],a[i-1]);
    }
    for (int i=0;i<n;++i)
    {
        cin>>x;
        ans=max(ans,a[i]*x);
        cout<<ans<<"\n";
    }
    return 0;
}