# -*- coding: utf-8 -*- ''' 数字のグループ分け 1,2,3,5,7 0,4,6,9 8 ''' n = input() singles = ['0','4','6','9'] doubles = ['8'] answer = 0 # 文字自体の他色変更 answer += len(n) # 背景の黒塗りつぶし answer += 1 # 文字の中の図形の黒塗りつぶし for c in n: if c in singles: answer += 1 elif c in doubles: answer += 2 # 文字自体の白塗りつぶし answer += len(n) print(answer)