class Integer def mod_pow(n, mod) x = self res = 1 while n > 0 res = res * x % mod if n[0] == 1 x = x * x % mod n >>= 1 end res end def mod_inverse(mod) mod_pow(mod - 2, mod) end end B, C, D = gets.split.map(&:to_i) MOD = 10 ** 9 + 7 def sum(a, r, n, mod) return a % mod if n == 1 x = sum(a, r, n / 2, mod) ret = (x + r.pow(n / 2, mod) * x) % mod ret = (a + r * ret) % mod if n.odd? ret end S = sum(C, C, D, MOD) puts (B * S) % MOD