N, L, H = gets.split.map &:to_i C = gets.split.map &:to_i def f(l, h, c) h/c - (l-1)/c end p (1..N).map{|n| C.combination(n).map{|a| f(L, H, a.inject(:lcm)) }.sum * n * (n.odd? ? 1 : -1) }.sum