#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,zbir;int n,n1,n2;
    l = x / p ; l1 = x / q ; l2 = x / r;
    n = l ; n1 = l1; n2 = l2;

    zbir = l + p + q;

    if( zbir != static_cast<int>(zbir))
    {
        float z;int x1;
        x1 = zbir;
        z = zbir - x1;
        zbir = zbir - z + 1;


      if(zbir <= x ) g++;
}


}
cout << g <<endl;
return 0;
}