C, N, M = map(int, input().split()) MOD = 10**9+7 A = [[0]*4 for _ in range(4)] inv = pow(C, MOD-2, MOD) A[0][2] = A[1][3] = 1 A[2][1] = A[2][2] = A[3][3] = inv A[3][0] = (C-1)*inv % MOD A[3][1] = (C-2)*inv % MOD def multiple(X, Y): r = len(X) c = len(Y[0]) n = len(Y) Z = [[0]*c for _ in range(r)] for i in range(r): for j in range(c): for k in range(n): Z[i][j] += X[i][k]*Y[k][j] % MOD Z[i][j] %= MOD return Z L = 30 B = [] B.append(A) for _ in range(L): B.append(multiple(B[-1], B[-1])) v = [[0] for _ in range(4)] v[0][0] = 1 v[2][0] = inv for i in range(L): if (N >> i) & 1: v = multiple(B[i], v) p = (1-v[0][0]) % MOD ans = (1-pow(p, M, MOD)) % MOD print(ans)