S = str(input()) a = 0 for j in range(10): r = 0 for i in S: if str(j) == S[r]: a = a + j r = r + 1 print(a)