# Define the number of fill operations required for each digit fill_operations = { '0': 2, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 4, '7': 3, '8': 3, '9': 3, } n = input().strip() total = sum(fill_operations[c] for c in n) print(total)