use std::io::Read; fn main() { let mut a = String::new(); std::io::stdin().read_to_string(&mut a).ok(); let a: usize = a.trim().split('\n').next().unwrap().split_whitespace() .map(|s| s.parse::().unwrap()) .map(|s| if s % 15 == 0 { 8 } else if s % 5 == 0 || s % 3 == 0 { 4 } else { s.to_string().len() }) .sum(); println!("{}", a); }