#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;

  vector<int64_t> a(n), b(n);
  for (auto &ai : a) {
    cin >> ai;
  }
  for (auto &bi : b) {
    cin >> bi;
  }

  int64_t mxa = a[0];
  int64_t c = a[0] * b[0];
  cout << c << '\n';
  for (int i = 1; i < n; ++i) {
    mxa = max(mxa, a[i]);
    c = max(c, mxa * b[i]);
    cout << c << '\n';
  }

  return 0;
}

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

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl '\n'
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main() { 
    ll tt = 1, n, q, m, l, r, c, i, j, k, w;
    boost;
    
    // cin >> tt;
    ll ans = 1;

    for(int _ = 1; _ <= tt; _++){
        cin >> l >> r;

        cout << (l + r) / 2 sp (l - r) / 2 << nl;

    }   

    return 0;
}
