Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. 

Iahub has the following scheme of painting: he skips x - 1 consecutive bricks, then he paints the x-th one. That is, he'll paint bricks x, 2·x, 3·x and so on red. Similarly, Floyd skips y - 1 consecutive bricks, then he paints the y-th one. Hence he'll paint bricks y, 2·y, 3·y and so on pink.

After painting the wall all day, the boys observed that some bricks are painted both red and pink. Iahub has a lucky number a and Floyd has a lucky number b. Boys wonder how many bricks numbered no less than a and no greater than b are painted both red and pink. This is exactly your task: compute and print the answer to the question. 

Input

The input will have a single line containing four integers in this order: x, y, a, b. (1 ≤ x, y ≤ 1000, 1 ≤ a, b ≤ 2·109, a ≤ b).

Output

Output a single integer — the number of bricks numbered no less than a and no greater than b that are painted both red and pink.

Examples

Input

2 3 6 18


Output

3

Note

Let's look at the bricks from a to b (a = 6, b = 18). The bricks colored in red are numbered 6, 8, 10, 12, 14, 16, 18. The bricks colored in pink are numbered 6, 9, 12, 15, 18. The bricks colored in both red and pink are numbered with 6, 12 and 18. 
import java.sql.Time;
import java.util.Arrays;
import java.util.Locale;
import java.util.Scanner;


public class MainTest
{
    static void print(int a[])
    {
        for(int i=0;i<a.length;i++) System.out.print(a[i]+" ");
        System.out.println();
    }
    static void print(long a[])
    {
        for(int i=0;i<a.length;i++) System.out.print(a[i]+" ");
        System.out.println();
    }
    static void println(int a[])
    {
        for(int i=0;i<a.length;i++) System.out.println(a[i]+" ");
    }
    
    static int sum(int []a)
    {
        int res=0;
        for(int i=0;i<a.length;i++) res+=a[i];
        return res;
    }
    /*static int getMax()
    {
        int max=0;
        int k=0;
        for(int i=0;i<a.length;i++) if(a[i]>max) {max=a[i]; k=i;}
        a[k]=-1;
        return max;
    }*/
    /*static int[] getSimple(int from,int to)
    {
        int a[]=new int[to-from];
        for(int i=0;i<a.length;i++) a[i]=from+i;
        //print(a);
        int sum=0;
        for(int i=0;i<a.length;i++)
        {
            if(a[i]>0)
            {
                for(int j=i+1;j<a.length;j++) if(a[j]%a[i]==0) a[j]=0;
                sum++;
            }
        }
        int b[]=new int[sum];
        sum=0;
        for(int i=0;i<a.length;i++) if(a[i]>0) {b[sum]=a[i]; sum++;}
        //System.out.println("SIMPLE!");
        //print(a);
        return b;
    }*/
    static long[] getSimple(int from,int to)
    {
        long a[]=new long[to-from];
        for(int i=0;i<a.length;i++) a[i]=from+i;
        //print(a);
        int sum=0;
        for(int i=0;i<a.length;i++)
        {
            if(a[i]>0)
            {
                for(int j=i+1;j<a.length;j++) if(a[j]%a[i]==0) a[j]=0;
                sum++;
            }
        }
        long b[]=new long[sum];
        sum=0;
        for(int i=0;i<a.length;i++) if(a[i]>0) {b[sum]=a[i]; sum++;}
        //System.out.println("SIMPLE!");
        print(b);
        return b;
    }
    static int check(int a)
    {
        if(a==1) return 0;
        else return 1;
    }
    static int[] inverse(int []a, int x,int y)
    {
        int b[]=new int[a.length];
        for(int i=0;i<a.length;i++)
        {
            if(i>=x&&i<=y)
            {
                if(a[i]==1) b[i]=0;
                else b[i]=1;
                continue;
            }
            b[i]=a[i];
        }
        return b;
    }
    //static int a[];
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int x=in.nextInt();
        int y=in.nextInt();
        int a=in.nextInt();
        int b=in.nextInt();
        int res=0;
        int i=1;
        int j=0;
        //System.out.println(res);
        //System.out.println(a+"  "+b);
        /*
        while(x*i+(x*y)<=b)
        {
            res++;
            i++;
        }
        System.out.println(res);
        res=0;
        i=0;*/
        if(x==1)
        {
            if(y==1) {System.out.println(b-a+1); return;}
            System.out.println((b-a+1)/y);
            /*while(y*i<a)
            {
                i++;
            }
            while(y*i<=b)
            {
                res++;
                i++;
            }
            System.out.println(res);*/
            return;
        }
        if(y==1)
        {
            
            System.out.println((b-a+1)/x);
            return;
        }
        
        while(true)
        {
            while(true)
            {
                if(x*j==y*i) break;
                if(x*j<y*i) break;
                i++;
            }
            if(x*j==y*i) break;
            j++;
        }
        if(a==1) {System.out.println(b/(x*j)); return;}
        if(a%(x*j)==0) res++;
        System.out.println(b/(x*j)-a/(x*j)+res);
        //res=0;
        //if((x*j)-a>=0.0&&(x*j)<=b) res++;
        
        //System.out.println((x*j));
       
        /*res+=(b-a+1)/(x*j);
        System.out.println(res);
        res=0;
        i=0;
        while(a+i<=b)
        {
            
            if((a+i)%(x*j)==0) 
            {
                //System.out.println(a+i);
                res++;
                i+=x*j;
                continue;
            }
            i++;
        }
        System.out.println(res);
        /*res=0;
        i=0;
        j=0;
        
        while(x*i<a)
        {
            i++;
        }
        while(x*i<=b)
        {
            if((x*i)%y==0) res++;
            i++;
        }
        System.out.println(res);*/
    }
}
