use std::io::*; use std::str::FromStr; use std::cmp::{min, max}; use std::mem::swap; use std::collections::HashMap; fn read() -> T { let stdin = stdin(); let stdin_lock = stdin.lock(); let s = stdin_lock .bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::(); s.parse::().ok().unwrap() } static DX: &'static [i32] = &[0, 0, 1, -1]; static DY: &'static [i32] = &[1, -1, 0, 0]; fn main() { let b: u64 = read(); let c: u64 = read(); let d: u64 = read(); let m = 1000000007u64; let mut p = pow_mod(c, d + 1, m); p = ((p + m - (c % m)) * (b % m)) % m; p = p * pow_mod(c - 1, m - 2, m) % m; println!("{}", p); } fn pow_mod(mut n: u64, mut exp: u64, m: u64) -> u64 { let mut t = 1; n %= m; while exp > 1 { if exp & 1 == 1 { t *= n; t %= m; } n *= n; n %= m; exp >>= 1; } (n * t) % m }