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 temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp: Vec = temp.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 val = temp.iter().fold(1usize, |x, &y| x * y % MOD); println!("{}", power(val, power(2, k, MOD-1), MOD)); }