use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let a: Vec = (0..5) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let mut ans = 0; for i in 0..5 { let mut n = a[i]; if n % 3 == 0 && n % 5 == 0 { ans += 8; } else if n % 3 == 0 || n % 5 == 0 { ans += 4; } else { while n > 0 { ans += 1; n /= 10; } } } println!("{}", ans); }