def fizzbuzz_len(i): if i % 15 == 0: return 8 elif i % 3 == 0: return 4 elif i % 5 == 0: return 4 else: return len(str(i)) a = list(map(int, input().split())) print(sum(list(map(fizzbuzz_len, a))))