N = int(eval(input()))



summ = []

for i in range(1,N//2 + 1):

    A = []

    B = []

    k = N-i

    for __ in range(6):

        A.append(int(i%10))

        B.append(int(k%10))

        i /= 10

        k /= 10

    summ.append(sum(A+B))

print((min(summ)))
N = int(eval(input()))



if N%10 == 0:

    print((10))

else:

    l = []

    for i in range(6):

        l.append(int(N%10))

        N /= 10

    print((sum(l)))
N = int(eval(input()))
summ = []
for i in range(1, N // 2 + 1):
    A = []
    B = []
    k = N - i
    for __ in range(6):
        A.append(int(i % 10))
        B.append(int(k % 10))
        i /= 10
        k /= 10
    summ.append(sum(A + B))
print((min(summ)))

N = int(eval(input()))
if N % 10 == 0:
    print((10))
else:
    l = []
    for i in range(6):
        l.append(int(N % 10))
        N /= 10
    print((sum(l)))

-summ = [] -for i in range(1, N // 2 + 1): -    A = [] -    B = [] -    k = N - i -    for __ in range(6): -        A.append(int(i % 10)) -        B.append(int(k % 10)) -        i /= 10 -        k /= 10 -    summ.append(sum(A + B)) -print((min(summ))) +if N % 10 == 0: +    print((10)) +else: +    l = [] +    for i in range(6): +        l.append(int(N % 10)) +        N /= 10 +    print((sum(l)))