n=input() def calc(x): if x in "12357": return 0 if x in "0469": return 1 return 2 ANS=len(n)*2+1 for x in n: ANS+=calc(x) print(ANS)