# Define the cost for each digit based on the problem's requirements digit_costs = { '0': 2, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 4, '7': 3, '8': 4, '9': 2 } n = input().strip() total = 0 for c in n: total += digit_costs[c] print(total)