uses crt;
var a,b,l,r,i,dem:integer;
begin
clrscr;
readln(a,b,l,r);
dem:=0;
for i:=l to r do
if (i mod a=0) and (i mod b=0) then inc(dem);
write(dem);
readln;
end.
var a,b,dem,L,i,R:longint;
begin
readln(a,b,L,R);
dem:=0;
for i:=L to R do
if (i mod a=0) and (i mod b=0) then inc(dem);
write(dem);
readln;
end.