use std::io::Read; fn solve(nm: Vec, p: f64) { let n = nm[0]; let m = nm[1]; if n > 1 && m > 1 { let corners: f64 = 4f64 * p * (p * p); let edges: f64 = (((2*n + 2*m) as f64) - 8f64) * p * (p * p * p); let inners: f64 = (((n - 2) * (m - 2)) as f64) * p * (p * p * p * p); println!("{}", corners + edges + inners); } else if n > 1 || m > 1 { let corners: f64 = 2f64 * p * (p); let edges: f64 = (((n * m) as f64) - 2f64) * p * (p * p); println!("{}", corners + edges); } else { println!("{}", p); } } fn main() { let mut all_data = String::new(); std::io::stdin().read_to_string(&mut all_data).ok(); let all_data: Vec<&str> = all_data.trim().split('\n').map(|s| s.trim()).collect(); let nm: Vec = all_data.iter().next().unwrap().split_whitespace().map(|b| b.parse::().unwrap()).collect(); let p: f64 = all_data.iter().skip(1).next().unwrap().parse::().unwrap(); solve(nm, p); }