use std::io; fn solve() { let mut s = String::new(); io::stdin().read_line(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let mut a: usize = itr.next().unwrap().parse().unwrap(); let mut b: usize = itr.next().unwrap().parse().unwrap(); let mut c: usize = itr.next().unwrap().parse().unwrap(); let k: usize = itr.next().unwrap().parse().unwrap(); for _ in 0..k { if a == b && b == c { break; } let x = (b + c) / 2; let y = (c + a) / 2; let z = (a + b) / 2; a = x; b = y; c = z; } println!("{}", a + b + c) } fn main() { let mut t = String::new(); io::stdin().read_line(&mut t).ok(); let t: usize = t.trim().parse().unwrap(); for _ in 0..t { solve(); } }