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