S = str(input()) num = 0 for i in range(len(S)): num += S.count(str(i)) * i print(num)