l = list(map(int, input().split())) c = 0 for i in l: if i%3==0: c += 4 if i%5==0: c += 4 elif i%3!=0: c += len(str(i)) print(c)