n,l,h,*z=`dd`.split.map &:to_i p (1..n).reduce(0){|r,i|z.combination(i){|v|e=v.reduce :lcm r-=(-1)**i*i*(h/e-~-l/e)};r}