#include<iostream>
using namespace std;
int main(){
    int p,q,r,b=0,n,s=0;
    unsigned int L,R;
    cin>>p>>q>>r>>L>>R;
    for(n=L;n<=R;n++){
        s=n/p+n/q+n/r;
        if(n%p!=0)
            s++;
        if(n%q!=0)
            s++;
        if(n%r!=0)
            s++;
        if(s<=n)
            b++;
    }
    cout<<b;
    return 0;
}