#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define rep(i,n) for(int i=0;i<(n);i++)
#define drep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N),B(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    vec<ll> ans(N+1);
    vec<ll> ma(N+1);
    rep(i,N) ma[i+1] = max(ma[i],A[i]);
    rep(i,N){
        ans[i+1] = max(ans[i],B[i]*ma[i+1]);
    }
    rep(i,N+1) if(i) cout << ans[i] << "\n";
}
#include<bits/stdc++.h>
using namespace std;
using P=pair<int,int>;
constexpr int mod=1000000007;
constexpr int inf=1e9;
int in(){
    int x;
    scanf("%d",&x);
    return x;
}
int main(){
    int n=in();
    long long a[n],b[n];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    long long amax=0,ans=0;
    for(int i=0;i<n;i++){
        amax=max(amax,a[i]);
        ans=max(ans,amax*b[i]);
        cout<<ans<<endl;
    }
    return 0;
}