#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long int
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector <int>
#define ff first
#define ss second
#define vp vector <pair<int,int>>
#define vpp vector <pair<int,pair<int,int>>>
#define seti set<int>
#define setbit(x) __builtin_popcountll(x)
#define sov(v) accumulate(all(v),0)
#define fs(it,a) for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pqmax priority_queue <int,vector <int>> 
#define pqmin priority_queue <int,vector <int>,greater<int>> 
#define dq deque <int>
#define umi unordered_map<int,int>
#define ums unordered_map<string,int>
#define sp(x,y) fixed << setprecision(y) << x
#define all(x) x.begin(),x.end()
#define f(x,y,z) for(x=y;x<z;x++)
#define si size()
#define countdigit(x) floor( log10(x) +1)
#define M 1000000007
#define Z 998244353 
#define fill(arr,x) memset(arr,x,sizeof(arr))
//Use (k%M+m)%m always where k is any no
#define PI 3.1415926535
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> pdbs; 
// null for set,mapped_type for map; 
//less for assending greater for descending
//ceil(a/b)=(a+b-1)/b
#define ghadi() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();
#define ee "\n"
#define re return 
 
 
 
//Author Rahul Sannigrahi
 
vector<int> take(int n)
{
    int i,j;
    vi v;
    f(i,0,n)
    {
        cin>>j;
        v.pb(j);
    }
    return v;
}
 
bool sortinrev(const pair<int,int> &a,  //desc of vp
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 

void show(vector<int>v)
{
    int i;
    for(i=0;i<v.si;i++)
    {
     cout<<v[i]<<" ";   
    }
    cout<<ee;
}
 
int decode()
{
    int i,j,k,l,n,x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    l=y1*x2+y2*x1;
    n=y1+y2;
   // cout<<l<<n;
    double d=(float)l/n;
    cout<<sp(d,10)<<ee;
    re 0;
}
 
int32_t main()
{
    IOS
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
    // #endif 
    
    int t=1;
    //cin>>t;
    while(t--)
    decode();
    return 0;
}
#include <iostream>
#include <cmath>
#define ll long long int
using namespace std;

int main() {
    int n;
    cin>>n;
    int a[n],b[n];
    ll ans[1001]={0};
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    for(int i=0;i<n;i++)
    {cin>>b[i];}
    for (int i=0;i<n;i++)
	{
		for (int j=a[i];j<=b[i];j++)
		{
			ans[j]++;
		}
	}
	ll cn=0;
	for (int i=0;i<=1000;i++)
	{
		if (ans[i]==n) cn++;
	}
	cout<<cn<<"\n";
    
    return 0;
}
