mod = 10**9 + 7 def mat_mul(X,Y): n,m = len(X),len(Y[0]) res = [[0 for j in range(m)] for i in range(n)] for i in range(n): for j in range(m): for k in range(len(Y)): res[i][j] += X[i][k] * Y[k][j] res[i][j] %= mod return res i3 = pow(3,mod-2,mod) def solve(C,N,M): iC = pow(C,mod-2,mod) A = [ [iC,0,0,iC], [0,iC,(C-1)*iC,(C-2)*iC], [1,0,0,0], [0,1,0,0] ] assert 1 <= N <= 10**9 base = [[1],[0],[0],[0]] mat = [[int(i==j) for j in range(4)] for i in range(4)] tmp = [[A[i][j] for j in range(4)] for i in range(4)] while N: if N&1: mat = mat_mul(tmp,mat) tmp = mat_mul(tmp,tmp) N >>= 1 base = mat_mul(mat,base) p = base[0][0] res = 1 - pow(1-p,M,mod) return res % mod C,N,M = map(int,input().split()) print(solve(C,N,M))