ans = 0 for s in input().split(): i = int(s) if i % 15 == 0: ans += 8 elif i % 3 == 0 or i % 5 == 0: ans += 4 else: ans += len(s) print(ans)