#include <bits/stdc++.h>
using namespace std;
int main() {
int p,q,r,L,R,g;
cin >> p >> q >> r >> L >> R;
g = 0;
for( float x = L ; x <= R ; x++ )
{
    float l,l1,l2;
    l = x / p ; l1 = x / q ; l2 = x / r;
    if( l != static_cast<int>(l))
    {
        float z;int x1;
        x1 = l;
        z = l - x1;
        l = l - z + 1;
    }
    if( l1 != static_cast<int>(l1))
    {
        float z;int x1;
        x1 = l1;
        z = l1 - x1;
        l1 = l1 - z + 1;
    }
    if( l2 != static_cast<int>(l2))
    {
        float z;int x1;
        x1 = l2;
        z = l2 - x1;
        l2 = l2 - z + 1;
    }

    if(l + l1 + l2 <= x ) g++;
}
cout << g <<endl;
return 0;
}