import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static final long MOD = 1000000007; public static final int SIZE = 2; public static long[][] mat_pow(long[][] mat, long p){ if(p == 0){ return new long[][]{{1, 0}, {0, 1}}; }else if(p == 1){ return mat; }else if(p % 2 != 0){ return mat_mul(mat, mat_pow(mat, p - 1)); }else{ final long[][] ret = mat_pow(mat, p / 2); return mat_mul(ret, ret); } } public static long[][] mat_mul(long[][] mat1, long[][] mat2){ long[][] ret = new long[SIZE][SIZE]; for(int i = 0; i < SIZE; i++){ for(int j = 0; j < SIZE; j++){ for(int k = 0; k < SIZE; k++){ ret[i][j] += mat1[i][k] * mat2[k][j]; ret[i][j] %= MOD; } } } return ret; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final long B = sc.nextLong(); final long C = sc.nextLong(); final long D = sc.nextLong(); final long B_mod = B % MOD; final long C_mod = C % MOD; if(D == 1){ System.out.println((B_mod * C_mod) % MOD); return; } final long[][] snd = mat_pow(new long[][]{{C_mod, 0}, {1, 1}}, D - 2); final long[][] fst = mat_mul(new long[][]{{C_mod, 0}, {(C_mod + 1) % MOD, 1}}, snd); //System.out.println(Arrays.deepToString(fst)); final long X = (fst[1][0] * B_mod) % MOD; final long X_ = (X * C_mod) % MOD; System.out.println((X_) % MOD); } }