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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (auto &e : a) cin >> e;
  for (auto &e : b) cin >> e;

  for (int i = 0; i + 1 < n; i++) a[i + 1] = max(a[i + 1], a[i]);

  ll r = 0;
  for (int i = 0; i < n; i++) cout << (r = max(r, a[i] * b[i])) << endl;
}

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ull unsigned long long
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define debug(x) cerr << #x << " = " << x << '\n';
#define pll pair <ll, ll>
#define fir first
#define sec second
#define INF 0x3f3f3f3f
#define int ll

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

const int maxn = 2e5 + 10;
int n,a[maxn],b[maxn],c[maxn];
signed main() {
  IO;
  cin >> n;
  rep(i,1,n) cin >> a[i];
  rep(i,1,n) cin >> b[i];
  int mx = 0;
  rep(i,1,n){
    mx = max(mx,a[i]);
    c[i] = max(c[i-1],b[i] * mx);
  }
  rep(i,1,n) cout << c[i] << '\n';
  return 0;
}