#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("rename-registers")
using namespace std;
int ile(long long a) {
  int count = 0;
  do {
    count++;
    a /= 10;
  } while (a);
  return count - 1;
}
long long pot(long long a, long long x) {
  if (x == 0) return 1;
  long long p = pot(a, x / 2);
  if (x % 2)
    return p * p * a;
  else
    return p * p;
}
int s(long long a) {
  int wyn = 0;
  while (a) {
    wyn += a % 10;
    a /= 10;
  }
  return wyn;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long b = pot(10, ile(n));
  long long c = n / b;
  c *= b;
  c--;
  long long d = n - c;
  cout << s(c) + s(d);
}

### Prompt

Develop a solution in Cpp to the problem described below:

You are given a positive integer n.

Let S(x) be sum of digits in base 10 representation of x, for example, S(123) = 1 + 2 + 3 = 6, S(0) = 0.

Your task is to find two integers a, b, such that 0 ≤ a, b ≤ n, a + b = n and S(a) + S(b) is the largest possible among all such pairs.

Input

The only line of input contains an integer n (1 ≤ n ≤ 10^{12}).

Output

Print largest S(a) + S(b) among all pairs of integers a, b, such that 0 ≤ a, b ≤ n and a + b = n.

Examples

Input

35


Output

17


Input

10000000000


Output

91

Note

In the first example, you can choose, for example, a = 17 and b = 18, so that S(17) + S(18) = 1 + 7 + 1 + 8 = 17. It can be shown that it is impossible to get a larger answer.

In the second test example, you can choose, for example, a = 5000000001 and b = 4999999999, with S(5000000001) + S(4999999999) = 91. It can be shown that it is impossible to get a larger answer.

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("rename-registers")
using namespace std;
int ile(long long a) {
  int count = 0;
  do {
    count++;
    a /= 10;
  } while (a);
  return count - 1;
}
long long pot(long long a, long long x) {
  if (x == 0) return 1;
  long long p = pot(a, x / 2);
  if (x % 2)
    return p * p * a;
  else
    return p * p;
}
int s(long long a) {
  int wyn = 0;
  while (a) {
    wyn += a % 10;
    a /= 10;
  }
  return wyn;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long b = pot(10, ile(n));
  long long c = n / b;
  c *= b;
  c--;
  long long d = n - c;
  cout << s(c) + s(d);
}

```