//Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined) {virtual,upsolve}
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>  
using namespace __gnu_pbds; 
using namespace std; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
typedef long long ll;
#define rep(a,n) for(int i = a;i<n;i++)
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y);	
#define F first
#define S second
#define all(x) x.begin(),x.end()
const int mod = 1e9+7;
const int mxN = 1+100*1000;
inline int lcm(int a,int b)
{
	return (a*b)/(__gcd(a,b));
}
signed main()
{

int n;
cin>>n;
vector<ll> a(n),b(n),c(n);
for(int i = 0;i<n;i++) cin>>a[i];
for(int i = 0;i<n;i++) cin>>b[i];
set<ll,greater<ll>> l;
for(int i = 0;i<n;i++)
{
    l.insert(a[i]);
    if(i==0)
    {
    	c[i] = (*l.begin())*b[i];
	}
	else {
		c[i] = max(c[i-1],b[i]*(*l.begin()));
	}
}

for(auto i : c) cout<<i<<endl;

}

#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>
#include <numeric>
#include <chrono>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define debug(x) cerr << #x << " = " << (x) << endl;
#define debug_pii(x) cerr << "(" << x.first << "," << x.second << ")";
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int gcd(int x, int y) {
  return (y == 0 ? x : gcd(y, x % y));
}

int lcm(int x, int y) {
    return (x*y)/gcd(x, y);
}

const int nmax = 2e5 + 10;
int n,m,u,v,w;
vector<pii> g[nmax];
ll dist[nmax][2][2];
const ll inf = 1e16;

struct state {
  int node;
  bool skip;
  bool add2;
  state(int node, bool skip, bool add2) {
    this->node=node;
    this->skip=skip;
    this->add2=add2;
  }
};

bool operator<(state const& lhs, state const& rhs) {
  return tie(lhs.node, lhs.skip, lhs.add2) < tie(rhs.node, rhs.skip, rhs.add2);
}

void solve() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  ll up = a[0];
  ll down = b[0];
  c[0] = up*down;
  ll maxm = up;

  for(int i = 1;i < n;i++) {
    c[i] = c[i-1];
    maxm = max(maxm, a[i]);
    if(b[i]*maxm > c[i]) {
      c[i] = b[i]*maxm;
    }
  }
  rep(i,n)cout<<c[i]<<endl;
}

//   10           -10
//       22  -22
//                       11     -11
//
// 55                                    -55
// 19                 -19
// k = 4 n = 6
// 1 2 3 |4| 3 2 ---> a

// 1 2  3 4 5    6 7 8 |9| 8 7 6

// p1 p2 p3 p4 p3 p2 --> b (inversion cnt b  <= a,   b is lex lexi.. maxm)
// 4 3 2 |1| 2 3

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);
 // cout << fixed << setprecision(15);2000000000

 ios_base::sync_with_stdio(false);
 cin.tie(nullptr);
 // prime_factors();
 int t = 1;
 // cin >> t;
 while (t--) {
   solve();
 }

 return 0;
}
