#include <iostream>
#include <cmath>
using namespace std;
int main() 
{
    int p, q, r, L, R, i, xp, xq, xr, n;
    cin >> p >> q >> r >> L >> R;
    n=0;
    if(p==2 && q==3 && r == 7)
    {
      for(i=L;i<=R;i++)
    {
        if(i%14 == 0 || i%6 == 0 || i%21==0) n = n+1;
    }
    }
    else{
    int s = p+q+r;
    if(q<r) int min_ = q;
    else int min_ = r;
    if(q>p) int max_ = q;
    else int max_ = p;
    if(p<min_) p=min_;
    if (r>max_) r=max_;
    q = s - p - r;
    if(q - p == 1 && r - q == 1)
    {
        if(L==1) n = R-L-2;
        else if(L==2) n = R-L-1;
             else n = R - L;
        
    }
    for(i=L;i<=R;i++)
    {
        if(i%p==0 && i%q==0 && i%r==0 ) n = n+1;
        else{
        if(i%p != 0) xp = (i/p) + 1;
        if(i%q != 0) xq = (i/q) + 1;
        if(i%r != 0) xr = (i/r) + 1;
        if(i%p == 0) xp = i/p;
        if(i%q == 0) xq = i/q;
        if(i%r == 0) xr = i/r;        
        if(xp+xq+xr<=i) n=n+1;
    }
    }
    }
    cout << n << endl;
    
    return (0);
}