eval'p [*%s..%s].repeated_permutation(%s).inject(1){_1*=_2.inject:gcd}.%%10**9+7'%gets.split