C, N, M = map(int, input().split()) MOD = 10 ** 9 + 7 iC = pow(C, MOD - 2, MOD) """pypy用行列累乗ライブラリは https://github.com/fujihiraryo/alogorithm-python/blob/master/integer/matrix.py から拝借しています。""" def product(a, b, p=MOD): n = len(a) c = [[0] * n for i in range(n)] for i in range(n): for j in range(n): c[i][j] = sum([a[i][k] * b[k][j] for k in range(n)]) % p return c def matpow(a, k, p=MOD): if k == 1: return a if k % 2 == 0: b = matpow(a, k // 2) return product(b, b, p=p) return product(a, matpow(a, k - 1), p=p) A = [[iC, 0, 0, 1 - iC], [0, iC, iC, 1 - 2 * iC], [1, 0, 0, 0], [0, 1, 0, 0]] tmp = matpow(A, N)[0][0] ans = (1 - pow(1 - tmp, M, MOD)) % MOD print(ans)