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