fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Failed to read line");
    let hander:Vec<i32> = input
    .trim()
    .split_whitespace()
    .map(|x| x.parse().expect("Failed to parse number"))
    .collect();

    let N=hander[0];
    let M=hander[1];
    input.clear();

    let mut total = 0;
    for i in 0..N{
        std::io::stdin().read_line(&mut input).unwrap();
        let mut line= input
        .trim()
        .split_whitespace()
        .filter(|x| x.parse::<i32>().unwrap()>0)
        .map(|x| x.parse::<i32>().unwrap())
        .sum::<i32>();

        total += line;
         input.clear();
    }
    println!("{}", total);
}