#![allow(dead_code)] #![allow(unused_imports)] #![allow(unused_mut)] #![allow(unused_macros)] #![allow(unused_variables)] #![allow(non_upper_case_globals)] #![allow(non_snake_case)] #![allow(unused_unsafe)] #![allow(unused_must_use)] use std::cmp::*; use std::collections::*; use std::io::{self, stdout, BufRead, BufWriter, Write}; macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); s }; let mut iter = s.split_whitespace(); input_inner!{iter, $($r)*} }; } macro_rules! input_inner { ($iter:expr) => {}; ($iter:expr, ) => {}; ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; } macro_rules! read_value { ($iter:expr, ( $($t:tt),* )) => { ( $(read_value!($iter, $t)),* ) }; ($iter:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($iter, $t)).collect::>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::>() }; ($iter:expr, bytes) => { read_value!($iter, String).bytes().collect::>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } macro_rules! dd { ($($a:expr),* $(,)*) => { #[cfg(debug_assertions)] eprintln!(concat!($("\x1b[38;5;39m|\x1b[m \x1b[38;5;39m", stringify!($a), " =\x1b[m {:?} "),*, "\x1b[38;5;69m|\x1b[m \x1b[38;5;6m"), $(&$a),*); }; } macro_rules! w { ($output:expr, $x:expr) => { let _ = writeln!($output, "{}", $x); }; } fn pow_mod(r: u64, mut n: u64, m: u64) -> u64 { let mut t = 1; let mut r = r; while n > 0 { if n & 1 == 1 { t = t * r % m; } r = r * r % m; n >>= 1; } t } fn main() { let out = stdout(); let mut out = BufWriter::new(out.lock()); input!(a: u64, b: u64, c: u64, k: u64); const MOD: u64 = 1_000_000_007; let ans = pow_mod(a * b % MOD * c % MOD, pow_mod(2, k, MOD - 1), MOD); writeln!(out, "{}", ans); }