N=int(eval(input()));print((min(sum(map(int,str(i)+str(N-i)))for i in range(1,N))))
n=sum(map(int,eval(input())));print(([n,10][n<2]))
N = int(eval(input()))
print((min(sum(map(int, str(i) + str(N - i))) for i in range(1, N))))

n = sum(map(int, eval(input())))
print(([n, 10][n < 2]))

-N = int(eval(input())) -print((min(sum(map(int, str(i) + str(N - i))) for i in range(1, N)))) +n = sum(map(int, eval(input()))) +print(([n, 10][n < 2]))