use std::cmp::*; use std::collections::*; use std::io::*; use std::str::FromStr; fn read() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } fn main(){ let n:usize = read(); let m:usize = read(); let mut a:Vec = vec![0;n]; for i in 0..n{ let mut rec:i64 = 0; for _j in 0..m { let l:i64 = read(); rec += l; } a[i] = rec; } let mut dp:Vec> = vec![vec![0;2];n]; dp[0][0] = a[0]; for i in 1..n{ dp[i][0] = max(dp[i - 1][1] + a[i],a[i]); dp[i][1] = max(dp[i - 1][0] - a[i],0); } let mut ans:i64 = 0; for i in 0..n{ for j in 0..2{ ans = max(ans,dp[i][j]); } } println!("{}",ans); }