n = input() group1, group2 = 0, 0 for n_i in n: if n_i in ['0', '4', '6', '9']: group1 += 1 if n_i in ['8']: group2 += 1 ans = len(n) + 1 + group1 + group2 * 2 + len(n) print(ans)