#include #include #include #include long long expInt(int base, int exp) { long long result = 1; for (int i = 0; i < exp; i++) { result *= base; } return result; } long long modDecomp(int base, int modulo, int power) { if (power == 0) { return base % modulo; } return expInt(modDecomp(base, modulo, power-1), 2) % modulo; } int main() { int a, b; long long t; const long long modulo = expInt(10, 9) + 7; scanf("%d", &a); scanf("%d", &b); scanf("%Ld", &t); const int base = (a + b) / 2; long long result = 1; // Decompose exponent into powers of 2 int powers[64] = {0}; long long mask = 0x1; for (int i = 0; i < 64; i++) { if ((t & mask) != 0) { powers[i] = 1; } mask <<= 1; } for (int i = 0; i < 64; i++) { if (powers[i]) { result *= modDecomp(base, modulo, i); result %= modulo; } } printf("%Ld", result); return 0; }