#include <iostream>
#include<cmath>
#include<vector>
#include<set>
#include <algorithm>
#include<map>
#include<string>
#include <chrono>
using namespace std;typedef long long ll;
#define rep(i,n) for(i=0;i<n;i++)
#define pb push_back
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007 //問題による
#define FORA(i,I) for(const auto& i:I)
ll myceil(ll a,ll b){return (a+(b-1))/b;}//aをbで割る時の繰上げ
ll myfloor(ll a,ll b){return a/b;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll c,ll d){ll g=gcd(c,d);return (c/g)*d;}
ll PRS(ll N, ll P, ll M){if(P==0)return 1;if(P%2==0){ll t=PRS(N,P/2,M);return t*t % M;}return N*PRS(N,P-1,M);}//繰り返し自乗
ll count(ll a){
    ll i=1;
    ll c=0;
    for(i=1;i<=sqrt(a);i++){
        if(a%i==0 && i!=a/i){
            c+=2;
        }else if(a%i==0){
            c++;
        }
    }
    return c;
}
int main() {
    ll i,j,k,n;
    cin>>n;
    vector<ll>a(n),b(n);
    vector<ll>c;
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        cin>>b[i];
    }
    ll mxa=0,mxb=0;
    ll pre=0;
    rep(i,n){
        mxa=max(mxa,a[i]);
        ll ans=max(pre,mxa*b[i]);
        cout<<ans<<endl;
        pre=ans;
        
    }
    return 0;
    
}



#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,i,j,max1=0,max2=0,l=-1,r=-1;
  	cin>>n;
  	long a[n],b[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  for(i=0;i<n;i++)
    cin>>b[i];
  for(i=0;i<n;i++)
  {
    if(max2>r)
    r=max2;
		if(a[i]>max1)
        {
          l=i;
          max1=a[i];
        }
    	/*if(b[i]>max2)
        {
          r=i;
          max2=b[i];
        }*/
    max2=(long long)max1*b[i];
    
    if(r>max2)
    cout<<r<<endl;
    else
      cout<<max2<<endl;
  }
}
  