use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut s = s.trim().split_whitespace(); let _n: usize = s.next().unwrap().parse().unwrap(); let v: Vec = s.map(|e| e.parse().unwrap()).collect(); let (mut a, mut b, mut c) = (0usize, 0usize, 0usize); for i in v { c = b + i; b = if a > b { a } else { b }; a = c; } println!("{}", if a > b { a } else { b }); }