use std::cmp::max; fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let mut a: Vec = vec![]; for _ in 0..n { let mut tempa = String::new(); std::io::stdin().read_line(&mut tempa).ok(); let tempa: i64 = tempa.trim().split_whitespace().map(|s| s.parse::().unwrap()).sum::(); a.push(tempa); } let mut dp: Vec> = vec![vec![0; n as usize + 1]; 2]; for i in 0..(n as usize) { dp[0][i+1] = max(dp[0][i], dp[1][i] + a[i]); dp[1][i+1] = max(dp[1][i], dp[0][i] - a[i]); } println!("{}", dp[0][n as usize]); }