use std::io::{self, Read};
//use libc::{clock_gettime, timespec, CLOCK_PROCESS_CPUTIME_ID};

fn main() {
    let mut sum = 0;
    let mut data = String::new();
    io::stdin().read_to_string(&mut data).unwrap();
    /* let mut begin = timespec {
        tv_sec: 0,
        tv_nsec: 0,
    };
    unsafe {
        clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &mut begin);
    }; */
    for line in data.lines() {
        let mut vec = Vec::new();
        for c in line.chars() {
            if c.is_digit(10) {
                let f = c.to_digit(10).unwrap();
                vec.push(f);
            }
        }
        let mut sussy = vec.first().unwrap().to_owned();
        sussy = sussy * 10 + vec.last().unwrap().to_owned();
        sum += sussy;
        println!("{sum}");
    };

    /* let mut end = timespec {
        tv_sec: 0,
        tv_nsec: 0,
    };
    unsafe {
        clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &mut end);
    };
    println!(
        "time: {:.6}ms",
        (end.tv_nsec - begin.tv_nsec) as f32 / 1000.0 / 1000.0
    ); */
}
