a=list(map(int,input())) count=0 for i in range(len(a)): if a[i]%3 and a[i]%5: count+=8 elif a[i]%3: count+=4 elif a[i]%5: count+=4 else: count+=len(a[i]) print(count)