use std::io::Read; fn run() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let n: i64 = it.next().unwrap().parse().unwrap(); let y: Vec = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect(); let sum = y.iter().fold(0, |s, a| s + *a); let mut out = String::new(); for y in y { let x = sum - (n - 1) * y; out.push_str(&format!("{} ", x)); } out.pop(); println!("{}", out); } fn main() { run(); }