fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let xx: Vec = xx.split_whitespace().skip(1).flat_map(str::parse).collect(); let n = xx.len(); let answer = xx .iter() .enumerate() .map(|(i, &x)| (i + 1) * (n - i) * x) .sum::(); println!("{answer}"); }