#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int p, q, r, br = 0;
    long long int l, s;

    cin >> p >> q >> r >> l >> s;

    int a, b, c, d;

    a = q*r;
    b = p*r;
    c = p*q;
    d = p*q*r;

    if(a+b+c == d-2 || a+b+c == d-1){
        for(int i = l+1; i < s; i++)
            if(i%p == 0 || i%q == 0 || i%r == 0)
                br++;
        cout << s-l-1-br;
    }
    else if(ceil(a+b+c)/d <= 1)
        cout << s-l-1;
    else if(a+b+c > d)
        cout << 0;

    return 0;
}