use std::collections::*; struct Scanner { stack: VecDeque>, input: R, } impl Scanner { fn new(input: R) -> Self { Self { stack: VecDeque::>::new(), input: input, } } fn take(&mut self) -> Option { while let Some(s) = self.stack.front_mut() { if let Some(t) = s.pop() { return Some(t); } self.stack.pop_front(); } self.enqueue_line(); if !self.stack.is_empty() { return self.take(); } None } fn enqueue(&mut self, t: String) { self.stack.push_back( t.trim() .split_ascii_whitespace() .map(|s| s.to_owned()) .rev() .collect(), ) } #[allow(unused)] fn enqueue_line(&mut self) { let mut t = String::new(); self.input.read_line(&mut t).ok(); self.enqueue(t); } #[allow(unused)] fn enqueue_to_end(&mut self) { let mut t = String::new(); self.input.read_to_string(&mut t).ok(); self.enqueue(t); } } #[allow(unused)] macro_rules! scan { ($io:expr => $t:ty) => { $io.take().unwrap().parse::<$t>().unwrap() }; ($io:expr => $t:tt * $n:expr) => ((0..$n).map(|_| scan!($io => $t)).collect::>()); ($io:expr => $($t:tt),*) => (($(scan!($io => $t)),*)); } macro_rules! scan { ($io:expr => $t:ty) => { $io.take().unwrap().parse::<$t>().unwrap() }; ($io:expr => $t:tt * $n:expr) => ((0..$n).map(|_| scan!($io => $t)).collect::>()); ($io:expr => $($t:tt),*) => (($(scan!($io => $t)),*)); } fn main() { solve(Scanner::::new(std::io::stdin().lock())) } fn solve(mut cin: Scanner) { let n = scan!(cin => i32); let aa = scan!(cin => i32 * n); let total = aa.iter().fold(0 as i64, |s, e| s + *e as i64); println!("{}", total); }