use std::io::{self, Read}; fn main() { let mut buf = String::new(); io::stdin().read_to_string(&mut buf).unwrap(); let lines: Vec = buf.lines().map(ToOwned::to_owned).collect(); let answer: Result = lines .into_iter() .map(|l| l.chars().filter(char::is_ascii_digit).collect()) .map(|s: String| [s.chars().next().unwrap(), s.chars().last().unwrap()].to_owned()) .map(String::from_iter) .map(|s| s.parse::()) .sum(); let answer = answer.unwrap(); print!("{answer}"); }