Problem:
Score : 200 points

Problem Statement

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".

Sample Input 1

15

Sample Output 1

6

When A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.

Sample Input 2

100000

Sample Output 2

10

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;


namespace practice1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            MYCP.PrintNumber((long)MYCP.SumKeta(n));

            return;
        }

        

    }

    

    class MYCP
    {
        //int変数を標準出力する
        public static void PrintNumber(long number)
        {
            Console.WriteLine("" + number);
        }

        //int変数の配列を標準出力する
        public static void PrintNumbers(int[] a)
        {
            if (a.Length == 0) return;

            Console.Write(a[0]);

            for(int i = 1; i < a.Length; i++)
            {
                Console.Write(" ");
                Console.Write(a[i]);
            }

            Console.WriteLine();
        }


        //文字列を配列化して返す
        public static string[] MyReadLineSplit()
        {
            return Console.ReadLine().Split();
        }


        //double変数をソートする
        public static void MyDoubleSort(double[] boo)
        {
            if (boo.Length < 2) return;

            long i, count;
            double a;

            while (true)
            {
                count = 0;

                for (i = 0; i < boo.Length - 1; i++)
                {
                    if (boo[i] > boo[i + 1])
                    {
                        a = boo[i];
                        boo[i] = boo[i + 1];
                        boo[i + 1] = a;
                        count++;
                    }
                }

                if (count == 0) break;
            }
        }

        //int変数をソートする
        public static void MyIntSort(int[] boo)
        {
            if (boo.Length < 2) return;

            long i, count;
            int a;

            while (true)
            {
                count = 0;

                for (i = 0; i < boo.Length - 1; i++)
                {
                    if (boo[i] > boo[i + 1])
                    {
                        a = boo[i];
                        boo[i] = boo[i + 1];
                        boo[i + 1] = a;
                        count++;
                    }
                }

                if (count == 0) break;
            }
        }

        //指定された個数分int変数を読み取る
        public static int[] ReadNumbers(long number)
        {
            int[] a = new int[number];
            string[] buff = MyReadLineSplit();
            for (long i = 0; i < number; i++)
            {
                a[i] = int.Parse(buff[i]);
            }

            return a;
        }

        //指定された個数分BigInteger変数を読み取る
        public static BigInteger[] ReadBigIntegers(long number)
        {
            BigInteger[] a = new BigInteger[number];
            string[] buff = MyReadLineSplit();
            for(long i = 0; i < number; i++)
            {
                a[i] = BigInteger.Parse(buff[i]);
            }

            return a;
        }



        //渡された自然数が素数か判定する。素数ならtrueを返す。
        public static bool PrimeCheck(int number)
        {
            if (number < 2) return false;

            for(int i = 2; i < number; i++)
            {
                if (number % i == 0) return false;
            }

            return true;
        }

        //渡された自然数が累乗数か判定する。累乗数ならtrueを返す。
        public static bool Bekizyousuu_Check(int number)
        {
            if (number == 1) return true;

            int i, copy;


            for (i = 2; i < number; i++)
            {
                copy = number;
                while (copy % i == 0)
                {
                    copy /= i;
                }

                if (copy == 1) return true;
            }

            return false;
        }

        //BIgIntegerで累乗計算を行う
        public static BigInteger MyPowerBigInteger(BigInteger a,BigInteger b)
        {
            BigInteger i, x = 1;

            for (i = 0; i < b; i++)
            {
                x *= a;
            }

            return x;
        }

        //渡されたBigIntegerの配列の和を求める
        public static BigInteger MySumBigInteger(BigInteger[] a)
        {
            BigInteger sum = 0;
            int i;

            for (i = 0; i < a.Length; i++)
            {
                sum += a[i];
            }

            return sum;

        }

        public static BigInteger SumKeta(BigInteger a)
        {
            if (a <= 0) return 0;
            BigInteger sum = 0;

            while (a > 0)
            {
                sum += a % 10;
                a -= a % 10;
                a /= 10;

            }

            return sum;

        }
    }
}