fn main() { let mut input = String::new(); std::io::stdin().read_line(&mut input).ok(); println!( "{}", input .trim() .split_whitespace() .map(|x| x.parse::().unwrap()) .map(|a| match (a % 3, a % 5) { (0, 0) => 8, (_, 0) => 4, (0, _) => 4, _ => a.to_string().len(), }) .sum::() ); }