A = map(int, input().split()) x = 0 for a in A: if a % 5 == 0: x += 4 if a % 3 == 0: x += 4 else: x += len(str(a)) print(x)