#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>

int main()
{
	std::ios::sync_with_stdio(false);
        int p,q,r,p1,p2,p3;long long L,L1,L2,L3,R;
            long long c = 0,tt;double t;
                std::cin >> p >> q >> r;
                    std::cin >> L >> R;
                        if(p > q){p1 = p;while(p1%q)p1+=p;}
                            else{ p1 = q; while(p1%p)p1+=q;}
                                if(p > r){p2 = p;while(p2%r)p2+=p;}
                                    else {p2 = r;while(p2%p)p2+=r;}
                                        if(q > r){p3 = q;while(p3%r)p3+=q;}
                                            else {p3 = r;while(p3%q)p3+=r;}
                                                tt = L;
                                                    while(tt%p1)tt+=1;
                                                        while(tt <= R){ tt+=p1;c++;}
                                                              tt = L;
                                                                  while(tt%p2)tt+=1;
                                                                      while(tt <= R){ tt+=p2;c++;}
                                                                            tt = L;
                                                                                while(tt%p3)tt+=1;
                                                                                    while(tt <= R){ tt+=p3;c++;}
                                                                                       std::cout << c;
                                                                                       }