import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int sum = 0; for (int i = 0; i < 5; i++) { int a = sc.nextInt(); if (a % 3 == 0 && a % 5 == 0) { sum += 8; } else if (a % 3 == 0 || a % 5 == 0) { sum += 4; } else { sum += String.valueOf(a).length(); } } System.out.println(sum); sc.close(); } }