#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long a[n];
  long long b[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
   cin>>b[i];

  multiset<long long,greater<long long>> m;
  long long max1=0;
  cout<<a[0]*b[0]<<endl;
  max1=a[0]*b[0];
  m.insert(max1);
  max1=a[0];
  for(int i=1;i<n;i++){
    max1=max(a[i],max1);
    m.insert(b[i]*max1);
    auto it=m.begin();
    cout<<*it<<endl;
  }

}

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

#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;++i)
#define per(i,a,b) for(int i=(a),i##end=(b);i>=i##end;--i)
//mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template<typename T>void chkmax(T&x,T y){if(x<y)x=y;}
template<typename T>void chkmin(T&x,T y){if(x>y)x=y;}
inline int read(){
  #define nc getchar()
  bool f=0;int x=0;char c=nc;
  while(c<48)f|=c=='-',c=nc;
  while(c>47)x=x*10+(c^48),c=nc;
  return f?-x:x;
  #undef nc
}

typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int maxn=2e5+10;
int n,A[maxn],B[maxn];

void solve(){
  cin>>n;
  rep(i,1,n)A[i]=read();rep(i,1, n)B[i]=read();
  int v1=0,v2=0;ll ans=0;
  rep(i,1,n){
    chkmax(v1,A[i]);
    chkmax(ans,1ll*v1*B[i]);
    printf("%lld\n",ans);
  }
}

signed main(){
//  int T=read();
//  while(T--)solve();
  solve();
  return 0;
}
