import java.util.Scanner;

/**
 *
 * @author Ivan
 */
public class Lubenice {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        float p = input.nextFloat();
        float q = input.nextFloat();
        float r = input.nextFloat();
        int L = input.nextInt();
        long R = input.nextLong();
        int sum = 0;
        for (int i = L; i < R; i++) {
            float a =i/p;
            float b =i/q;
            float c =i/r;
                    
            if(i%p<=0.5){
                a++;
            }
            if(i%q<=0.5){
                b++;
            }
            if(i%r<=0.5){
                c++;
            }
            
            
            
            
            if (a+b+c <= i) {
                sum++;
            }
           
            
        }
        System.out.println(sum);
        
    }

}