n = list(map(int, list(input()))) ans = 8 + 9 for i in range(len(n)-1): if n[i] == n[i+1]: ans += 9 else: ans += 8 rl = [[n[0], 0]] for i in range(1,len(n)): if rl[-1][0] == n[i]: rl[-1][1] += 1 else: rl.append([n[i], 1]) print(ans + len(rl))