import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); long b = sc.nextLong() % MOD; long c = sc.nextLong() % MOD; long d = sc.nextLong(); System.out.println(sum(b * c % MOD, c, d)); } static long pow(long x, long y) { long ret = 1; x %= MOD; while (y > 0) { if (y % 2 == 1) { ret *= x; ret %= MOD; } x *= x; x %= MOD; y /= 2; } return ret; } static long sum(long a, long r, long n) { if (n == 1) { return a % MOD; } long x = sum(a, r, n / 2); long ret = (x + pow(r, n / 2) * x) % MOD; if (n % 2 == 1) { ret *= r; ret += a; ret %= MOD; } return ret; } }