#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<ll> amax(n);
    ll cmax = 0;
    REP(i,n) {
        ll a; cin >> a;
        if (i != 0) amax[i] = max(a,amax[i-1]);
        else amax[i] = a;
    }
    REP(i,n) {
        ll b;
        cin >> b;
        cmax = max(cmax,amax[i] * b);
        cout << cmax << '\n';
    }

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 2e5+5;

ll a[sz], b[sz], ans[sz];

int main() {
   int n;
   cin >> n;
   for(int i=1; i<=n; i++) scanf("%lld", &a[i]), a[i] = max(a[i-1], a[i]);
   for(int i=1; i<=n; i++) scanf("%lld", &b[i]);
   for(int i=1; i<=n; i++) {
      ans[i] = max(ans[i-1], a[i] * b[i]);
      printf("%lld\n", ans[i]);
   }
}
