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 if c == 1: print(b * d) else: print(b * (pow(c, d + 1, mod) - c) * modinv(c - 1, mod) % mod)