import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int cnt = 0; for(int i = 0; i < 5; i++) { int t = scan.nextInt(); if(t % 15 == 0) { cnt += 8; }else if(t % 3 == 0 || t % 5 == 0) { cnt += 4; }else { String s = Integer.toString(t); cnt += s.length(); } } scan.close(); System.out.println(cnt); } }