#include <bits/stdc++.h>

using namespace std;

int main(){

    unsigned long long int p,q,r,s,e;
    unsigned long long int a,b,c;
    cin >> a >> b >> c >> s >> e;

    p = min(a,min(b,c));
    r = max(a,max(b,c));
    q = a+b+c-p-r;
    unsigned long long int z = 0;
    unsigned long long int t;
    if(p == 1 ||(p==2 && q== 2) || (p==2 && q == 3 && r <= 5)){
        z = e-s;
    }
    else{
        if(p == 2 && q == 3 && r == 6){
            t = 0;
            if(s < 6){
                t = 1;
            }
            z = t+e-(e/6)-(s-(s/6));
        }
        else if(p == 2 && q == 4 && r == 4){
            t = 0;
            if(s < 4){
                t = 1;
            }
            z = t+e-(e/4)-(s-(s/4));
        }
        else if(p == 3 && q == 3 && r == 3){
            t = 0;
            if(s < 3){
                t = 1;
            }
            z = t+e-(e/3)-(s-(s/3));
        }
        else{
            z = 0;
            for(int i = s; i <= min(e,(p*q*r)+1);i++){
                if(ceil((double)i/p)+ceil((double)i/q)+ceil((double)i/r)>i){
                    z+=1;
                }
            }
        }
    }

    z = e-s-z+1;
    cout << z;

    return 0;
}