atcoder#AGC025A. [AGC025A] Digits Sum

[AGC025A] Digits Sum

Score : 200200 points

Problem Statement

Takahashi has two positive integers AA and BB.

It is known that AA plus BB equals NN. Find the minimum possible value of "the sum of the digits of AA" plus "the sum of the digits of BB" (in base 1010).

Constraints

  • 2N1052 \leq N \leq 10^5
  • NN is an integer.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the minimum possible value of "the sum of the digits of AA" plus "the sum of the digits of BB".

15
6

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

100000
10