Takahashi has two positive integers A and B.

It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10).

Constraints

* 2 ≤ N ≤ 10^5
* N is an integer.

Input

Input is given from Standard Input in the following format:


N


Output

Print the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B".

Examples

Input

15


Output

6


Input

100000


Output

10
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        SumOfDigits solver = new SumOfDigits();
        solver.solve(1, in, out);
        out.close();
    }

    static class SumOfDigits {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            long s = Integer.MAX_VALUE;
            for (int i = 1; i < n; i++) {
                int d = n - i;
                int j = i;

                long ds = 0L;
                while (d != 0) {
                    ds += d % 10;
                    d /= 10;
                }

                long js = 0L;
                while (j != 0) {
                    js += j % 10;
                    j /= 10;
                }

                s = Math.min(s, ds + js);
            }

            out.printf("%d\n", s);
        }

    }
}

