#include <iostream>

using namespace std;

int main()
{
    long long L,R,n,s=0,br=0;
    int p,q,r;
    cin>>p>>q>>r>>L>>R;
    while(L<=R){
        if(L%p==0)
            s=s+L/p;
        else
            s=s+1+L/p;
        if(L%q==0)
            s=s+L/q;
        else
            s=s+1+L/q;
        if(L%r==0)
            s=s+L/r;
        else
            s=s+1+L/r;
        if(s<=L)
            br++;
        s=0;
        L++;
    }
    cout<<br;
}