#include #include #include #include #include #include using namespace std; #define CACHE 1 int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ unsigned long long int mod = pow(10,9) + 7; unsigned long long int runningValue = 1; unsigned long long int a, b, t; unordered_map cache; cin >> a >> b >> t; unsigned long long int a_plus_b_by_2 = (a + b) / 2; if(CACHE){ cache[0] = 1; for(unsigned long long int i = 1; i <= 10; i++){ cache[i] = (cache[i - 1] * a_plus_b_by_2) % mod; } unsigned long long int exp = 10; while(exp <= t) { for(unsigned long long int i = 2; i <= 10; i++){ cache[(exp * i)] = (cache[exp * (i-1) ] * cache[exp]) % mod; } exp *= 10; } exp = 1; while(t > 0){ runningValue = (runningValue * cache[(t % 10) * exp]) % mod; t /= 10; exp *= 10; } } else { for(unsigned long long int i = 0; i < t; i++) runningValue = (runningValue * a_plus_b_by_2) % mod; } cout << runningValue << endl; return 0; }