import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = 0; for (int i = 0; i < 5; i++) { int x = sc.nextInt(); if (x % 3 == 0 && x % 5 == 0) { count += 8; } else if (x % 3 == 0) { count += 4; } else if (x % 5 == 0) { count += 4; } else { count += getCount(x); } } System.out.println(count); } static int getCount(int x) { int count = 0; while (x > 0) { count++; x /= 10; } return count; } }