N,X,Y,*A=`dd`.split.map &:to_i;s=0 (1<0&&(r=r.lcm A[j];d+=1)};s+=(Y/r-~-X/r)*d*(d%2*2-1)} p s