#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#define ll long long
#define rep(i, a, b) for (int i = a; i <= (int)b; i ++)
#define per(i, a, b) for (int i = (int)a; i >= b; i --)
template < typename T > void read(T & x) {
    x = 0; int flag = 1; char c = getchar();
    for(; !isdigit(c); c = getchar()) if(c == '-') flag = -1;
    for(; isdigit(c); c = getchar()) x = x * 10 + c - '0';
    x *= flag;
}
using namespace std;
const int maxn = 200010;
int n, a[maxn], b[maxn];
ll f[maxn];
int main()
{
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", &a[i]), a[i] = max(a[i], a[i - 1]);
	rep(i, 1, n) scanf("%d", &b[i]), f[i] = max(f[i - 1], 1ll * b[i] * a[i]);
	rep(i, 1, n) printf("%lld\n", f[i]);
    return 0;
}
#include <bits/stdc++.h>

#define MAX 200005

using namespace std;

int main() {
    int n; cin >> n;
    
    long long a[MAX], b[MAX];
    for (int i = 0; i < n; i++) cin >> a[i];
    
    for (int i = 0; i < n; i++) cin >> b[i];
    
    long long maxA = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        maxA = max(maxA, a[i]);
        ans = max(ans, maxA*b[i]);        
        cout << ans << "\n";
    }
    
    return 0;
}