#include #include #include #include void power(long double x, long y) { long res = 1; // Initialize result long p = 1000000000 + 7; //x = x % p; // Update x if it is more than or // equal to p while (y > 0) { // If y is odd, multiply x with result if (y % 2 != 0) res = ((long)(res*x)) % p; // y must be even now y = y/2; // y = y/2 x = ((long)(x*x)) % p; } printf("%ld", res); } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int a,b; long t; scanf("%d %d %ld",&a,&b,&t); long double x = (0.5 * a) + (0.5 * b); power(x,t); return 0; }