/* -*- coding: utf-8 -*- * * 1158.cc: No.1158 GCD Products easy - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 6; const int MOD = 1000000007; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; /* subroutines */ template T gcd(T m, T n) { // m > 0, n > 0 if (m < n) swap(m, n); while (n > 0) { T r = m % n; m = n; n = r; } return m; } /* main */ int main() { int a, b, n; scanf("%d%d%d", &a, &b, &n); int c = b + 1 - a; int t = 1; for (int i = 0; i < n; i++) t *= c; int p = 1; for (int s = 0; s < t; s++) { for (int i = 0, r = s; i < n; i++, r /= c) as[i] = r % c + a; int g = as[0]; for (int i = 1; i < n && g > 1; i++) g = gcd(g, as[i]); p = (ll)p * g % MOD; } printf("%d\n", p); return 0; }