import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) def modinv(a, mod=10 ** 9 + 7): return pow(a, mod - 2, mod) b, c, d = map(int, readline().split()) mod = 10 ** 9 + 7 b %= mod c %= mod if c == 1: print(b * d % mod) elif d == 1: print(b * c % mod) else: print(b * ((pow(c, d + 1, mod) + mod - c) % mod) * modinv(c - 1, mod) % mod)