#include <iostream>
using namespace std;
int main()
{
    int n=0;
    long long int x,p,r,L,R,x1,p1,r1;
    cin>>x>>p>>r>>L>>R;
    for (int i=L;i<R+1;i++)
    {
        if (i%x==0)  x1=i/x;
        else x1=i/x+1;
        if (i%p==0)  p1=i/p;
        else p1=i/p+1;
        if (i%r==0)  r1=i/r;
        else r1=i/r+1;
        if (x1+p1+r1<=i) n=n+1;
    }
    cout<<n;
    return 0;
}