fn main() { let stdin = std::io::read_to_string(std::io::stdin()).unwrap(); let mut stdin = stdin.split_ascii_whitespace(); let a: [u16; 5] = [ stdin.next().unwrap().parse().unwrap(), stdin.next().unwrap().parse().unwrap(), stdin.next().unwrap().parse().unwrap(), stdin.next().unwrap().parse().unwrap(), stdin.next().unwrap().parse().unwrap(), ]; use std::io::Write; std::io::stdout() .write_all(output(solve(a)).as_bytes()) .unwrap(); } fn solve(a: [u16; 5]) -> u32 { a.into_iter() .map(|a| match a % 15 { 0 => 8, 3 | 5 | 6 | 9 | 10 | 12 => 4, _ => a.to_string().len() as u32, }) .sum() } fn output(ans: u32) -> String { ans.to_string() + "\n" }