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