import java.util.*;
import java.math.*;
public class Zadatak1 {

    public static void main(String[] args) {

        Scanner a = new Scanner(System.in);
       long p=a.nextLong(),q=a.nextLong(),r=a.nextLong(),L=a.nextLong(),R=a.nextLong(),x,N=0;
       for(long i=L-1;i<=R;i++){
           x=(long)Math.ceil(i/p);
           long y=(long)Math.ceil(i/q);
           long z=(long)Math.ceil(i/r);
           long j=x+y+z;
           if(j<=N)
           N++;
       }
       System.out.println(N);


    }
}