b,c,d = map(int,input().split()) import sys P = 10 ** 9 + 7 if c == 1: print(b * d % P) else: t = pow(c,d,P) - 1 inv = (c - 1,P-2,P) ans = t * inv * b * c % P print(ans)