package algo; import java.util.*; public class sample7 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a1 = sc.nextInt(); int a2 = sc.nextInt(); int a3 = sc.nextInt(); int a4 = sc.nextInt(); int a5 = sc.nextInt(); List list = new ArrayList(); list.add(a1); list.add(a2); list.add(a3); list.add(a4); list.add(a5); int sum = 0; for(int i = 0; i < list.size(); i++) { if(list.get(i) % 3 == 0 && list.get(i) % 5 == 0) { sum += 8; } else if (list.get(i) % 5 == 0) { sum += 4; } else if (list.get(i) % 3 == 0) { sum += 4; } else { sum += list.get(i).toString().length(); } } System.out.println(sum); } }