import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000637_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String[] a = br.readLine().split(" "); int c = 0; for(int i = 0; i < a.length; i++) { int j = Integer.parseInt(a[i]); if(j % 3 == 0 && j % 5 == 0) { c += 8; } else if(!(j % 3 != 0 && j % 5 != 0)) { c += 4; } else { c += String.valueOf(j).length(); } } System.out.println(c); } }