local mod = 1000000007 local mfl = math.floor local function bmul(x, y) local x1, y1 = mfl(x / 31623), mfl(y / 31623) local x0, y0 = x - x1 * 31623, y - y1 * 31623 return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod end local function badd(a, b) return (a + b) % mod end local function getgcd(a, b) while 0 < b do a, b = b, a % b end return a end local a, b, n = io.read("*n", "*n", "*n") local range = b - a + 1 local tot = 1 for i = 1, n do tot = tot * range end local ret = 1 local t = {} for it = 0, tot - 1 do local tmp = it for i = 1, n do local v = tmp % range tmp = mfl(tmp / range) t[i] = a + v end local gcd = t[1] for i = 2, n do gcd = getgcd(gcd, t[i]) end ret = bmul(ret, gcd) end print(ret)