import sys MOD = 1000000007 class ModInt: def __init__(self, x): self.x = x % MOD def __str__(self): return str(self.x) __repr__ = __str__ def __add__(self, other): if isinstance(other, ModInt): return ModInt(self.x + other.x) else: return ModInt(self.x + other) def __sub__(self, other): if isinstance(other, ModInt): return ModInt(self.x - other.x) else: return ModInt(self.x - other) def __mul__(self, other): if isinstance(other, ModInt): return ModInt(self.x * other.x) else: return ModInt(self.x * other) def __truediv__(self, other): if isinstance(other, ModInt): return ModInt(self.x * pow(other.x, MOD - 2, MOD)) else: return ModInt(self.x * pow(other, MOD - 2, MOD)) def __pow__(self, other): if isinstance(other, ModInt): return ModInt(pow(self.x, other.x, MOD)) else: return ModInt(pow(self.x, other, MOD)) __radd__ = __add__ def __rsub__(self, other): if isinstance(other, ModInt): return ModInt(other.x - self.x) else: return ModInt(other - self.x) __rmul__ = __mul__ def __rtruediv__(self, other): if isinstance(other, ModInt): return ModInt(other.x * pow(self.x, MOD - 2, MOD)) else: return ModInt(other * pow(self.x, MOD - 2, MOD)) def __rpow__(self, other): if isinstance(other, ModInt): return ModInt(pow(other.x, self.x, MOD)) else: return ModInt(pow(other, self.x, MOD)) def main(): # sys.setrecursionlimit(100000) input = lambda: sys.stdin.readline()[:-1] B, C, D = map(int, input().split()) if not (C - 1) % MOD: ans = ModInt(B) * ModInt(D) else: B, C = map(ModInt, (B, C)) ans = B * ((C**D) - 1) / (C - 1) * C print(ans) if not __debug__: f = open(sys.argv[1], "r") sys.stdin = f # try: # sys.set_int_max_str_digits(100000) # except AttributeError: # pass main()