#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll N; cin >> N;
  ll a[N]; rep(i,N) cin >> a[i];
  ll b[N]; rep(i,N) cin >> b[i];
  ll result[N] = {}, ma = 0;
  rep(i,N) {
    ma = max(ma, a[i]);
    if (i==0) result[i] = ma*b[i];
    else result[i] = max(result[i-1], ma*b[i]);
  }
  debug(result,result+N);
  return 0;
}
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib> 
#include <ctime>
#include <unordered_map>
using namespace std;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) (sort(all(v)), v.erase(unique(all(v)), v.end()))
typedef long long ll;
typedef pair<int, int> p;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	vector<ll> x(n), y(n);
	for (auto &a : x) cin >> a;
	for (auto &a : y) cin >> a;
	ll mx = -1, value = -1;
	for (int i = 0; i < n; i++) {
		mx = max(mx, x[i]);
		value = max(value, mx*y[i]);
		cout << value << '\n';
	}
}