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