#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N;
    cin >> N;

    vector<LL> b(N), a(N);
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> b[i];
    }

    LL amx = 0;
    LL resmx = 0;
    vector<LL> res;
    for(int i = 0; i < N; ++i) {
        amx = max(a[i], amx);
        resmx = max(amx * b[i], resmx);
        cout << resmx << endl;
    }

    return 0;
}


/**
* 
*    created: 16.01.2021 21:01:06
**/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i<n;i++)
typedef pair<int,int> P;

int main() {

  ll n,t=0,ma;
  cin >> n; 
  vector <unsigned long long>a(n),b(n),c(n);
  rep(i,n){
    cin >> a.at(i);
  }
  rep(i,n){
    cin >> b.at(i);
  }

c.at(0)=a.at(0)*b.at(0);
//cout << c.at(0) << endl;
  ma=a.at(0);
  rep(i,n-1){
    if(ma<a.at(i+1)){
       t=i+1;
       ma=a.at(i+1);
     }
   if(a.at(i+1)>a.at(i)){
     if(b.at(i+1)>b.at(i)){
       c.at(i+1)=max(a.at(t)*b.at(i+1),c.at(i));
     }else{
       c.at(i+1)=max(a.at(t)*b.at(i+1),c.at(i));
     }
     
   }else{
     if(b.at(i+1)>b.at(i)){
       c.at(i+1)=max(a.at(t)*b.at(i+1),c.at(i));
       //cout << 888 << endl;
     }else{
       c.at(i+1)=c.at(i);
     }
   }
  }

  rep(i,n)
    cout << c.at(i) << endl;


}