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

int main() {
	int a,b,c,d,ans;
	
	cin>>a>>b>>c>>d;
	ans = max(a-c, max(a-d, max(b-c, b-d)));
	cout<<ans;
	return 0;
}
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
#define REP_sz(i,s) for(int i=0;i<s.size();i++)
#define gcd(a,b) __gcd(a,b)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define IT iterator
#define SET setprecision
#define FOR(i,a,n) for(int i=a;i<=(n);i++)
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
#define mod1 1000000007
#define mod2 998244353
#define infmod 9223372036854775783
using namespace std;
int n;
int a[200005],b[200005],ma[200005],c[200005];
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	cin>>n;
	REP(i,0,n)
	cin>>a[i];
	REP(i,0,n)
	cin>>b[i];
	ma[0]=a[0];
	REP(i,1,n)ma[i]=max(a[i],ma[i-1]);
	c[0]=a[0]*b[0];
	REP(i,1,n)c[i]=max(c[i-1],b[i]*ma[i]);
	REP(i,0,n)cout<<c[i]<<endl;
    return 0;
}
