const MOD: usize = 1e9 as usize + 7; fn power(base: usize, times: usize, modval: usize) -> usize { if times == 0 { return 1usize; } if times == 1 { return base; } let temp = power(base, times/2, modval); temp * temp % modval * power(base, times%2, modval) % modval } fn main() { let mut abc = String::new(); std::io::stdin().read_line(&mut abc).ok(); let abc: Vec = abc.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut k = String::new(); std::io::stdin().read_line(&mut k).ok(); let k: usize = k.trim().parse().unwrap(); let base = abc.iter().fold(1usize, |x, &y| x * y % MOD); let powval = power(2usize, k, MOD-1); println!("{}", power(base, powval, MOD)); }