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

int main(){
  ll n, aa = 0, bb = 0, ai = -1, bi = -1, bbb = 0;
  cin >> n;
  vector<ll> a(n), b(n);
  vector<ll> ans(n), am(n), bm(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n){
    if (b[i] > bb){
      bb = b[i];
      bi = i;
    }
    if (i == 0){
      am[i] = a[i];
      cout << am[i]*bb << endl;
      continue;
    }
    am[i] = max(am[i-1], a[i]);
    if (a[i] > am[i-1]){
      am[i] = a[i];
      ai = i;
      bbb = b[i];
    } else{
      am[i] = am[i-1];
      bbb = max(bbb, b[i]);
    }
    if (bbb*am[i] > am[bi]*bb){
      bi = ai;
      bb = bbb;
    }
    cout << am[bi]*bb << endl;
  }
}
#include <bits/stdc++.h>

using namespace std;

int main() {
    int w, x, y, z;
    cin >> w >> x >> y >> z;

    cout << min(min(w, x), min(y, z)) << endl;

    return 0;
}