/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <math.h>
#include <memory.h>
#include <stdio.h>

#include <algorithm>
#include <complex>
#include <ctime>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define left asdgashgrketwjklrej
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 1024

#define ldouble long double
using namespace std;

const int bs = 1000000007;

const long long N = 200031;

long long a[N],b[N],n,cur_max;
long long ans[N];

int main() {
    //freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    //cin.tie(0);

    cin>>n;
    for (int i=1;i<=n;i++){
    	cin>>a[i];
    }
    for (int i=1;i<=n;i++){
    	cin>>b[i];
    }

    cur_max=0;
    for (int i=1;i<=n;i++){
    	cur_max=max(cur_max,a[i]);
    	ans[i]=b[i]*cur_max;
    	ans[i]=max(ans[i],ans[i-1]);
    }

    for (int i=1;i<=n;i++){
    	cout<<ans[i]<<endl;
    }

    //cin.get(); cin.get();
    return 0;
}

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

struct fastio{fastio(){cin.tie(nullptr);ios_base::sync_with_stdio(false);std::cout<<std::fixed<<setprecision(10);}}oitsaf;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define repr(i,n) for(int i{n};i-->0;)
using i64 = int64_t;
template<class T>std::istream&operator>>(std::istream&is,std::vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T>std::ostream&operator<<(std::ostream&os,std::vector<T>const&v){for(auto const& vi:v)os<<vi<<" ";return os;}

int main() {
  int n;
  cin >> n;
  vector<i64> a(n), b(n);
  cin >> a >> b;
  vector<i64> c(n);
  vector<i64> a_max(n + 1);
  rep(i, n) a_max[i + 1] = max(a_max[i], a[i]);
  repr(i, n) c[i] = a_max[i + 1] * b[i];
  rep(i, n - 1) c[i + 1] = max(c[i + 1], c[i]);
  cout << (c) << endl;
}
