a, b, t = map(int, raw_input().split(' ')) x = (0.5 * a + 0.5 * b) print pow(int(x), t, 1000000007)