#include using namespace std; template T modpow(T a, T b, T p) { T ans = 1; while(b > 0) { if(b & 1) ans = ans * a % p; //bの最下位bitが1ならa^(2^i)をかける a = a * a % p; b >>= 1; //bを1bit右にシフト } return ans; } int main() { int64_t a, b, n; cin >> a >> b >> n; const int64_t mod = 1000000007; vector v(11); for(int64_t i = a; i <= b; i++) v[i] = 1; vector dp(11); for(int64_t i = 10; i >= 6; i--) if(v[i] == 1) dp[i] = 1; dp[5] = (modpow(v[5] + v[10], n, mod) - dp[10] + mod) % mod; dp[4] = (modpow(v[4] + v[8], n, mod) - dp[8] + mod) % mod; dp[3] = (modpow(v[3] + v[6] + v[9], n, mod) - dp[9] - dp[6] + 2 * mod) % mod; dp[2] = (modpow(v[2] + v[4] + v[6] + v[8] + v[10], n, mod) - dp[10] - dp[6] - dp[8] - dp[4] + 3 * mod) % mod; int64_t ans = 1; for(int64_t i = 10; i >= 2; i--) { ans *= modpow(i, dp[i], mod); ans %= mod; } cout << ans << endl; return 0; }