#include <bits/stdc++.h>
using namespace std;
vector<long long int> p[300005], q[300005], f(200005, -1), d(300005, 0),
    a(300005);
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int bpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res % 1000000007;
}
void fact(long long int i) {
  f[0] = 1;
  for (long long int k = 1; k <= i; k++) {
    (f[k] = f[k - 1] * k) %= 1000000007;
  }
}
long long int isprime(long long int n) {
  if (n == 1) return 0;
  for (long long int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return 0;
  return 1;
}
long long int find(long long int x) {
  if (f[x] == x)
    return x;
  else
    return f[x] = find(f[x]);
}
bool cmp(long long int x, long long int y) { return x < y; }
void check() {
  cout << "HI"
       << "\n";
}
long long int comb(long long int i, long long int j) {
  if (j > i) return 0;
  long long int k = f[i];
  long long int g = (f[j] * (f[i - j])) % 1000000007;
  long long int h = bpow(g, 1000000007 - 2);
  return (k * h) % 1000000007;
}
pair<long double, long double> az(long double a, long double b, long double c,
                                  long double d, long double u) {
  long double x1 = (a - c) * cos(u) - (b - d) * sin(u) + c;
  long double y1 = (a - c) * sin(u) + (b - d) * cos(u) + d;
  return {x1, y1};
}
int main() {
  long long int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int j = 1;
    while (j * 10 <= n) {
      j *= 10;
    }
    long long int u = (n / j) * j;
    u--;
    long long int v = n - u;
    long long int sum = 0;
    while (u > 0) {
      sum += (u % 10);
      u /= 10;
    }
    while (v > 0) {
      sum += (v % 10);
      v /= 10;
    }
    cout << sum << "\n";
  }
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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>
using namespace std;
vector<long long int> p[300005], q[300005], f(200005, -1), d(300005, 0),
    a(300005);
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int bpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res % 1000000007;
}
void fact(long long int i) {
  f[0] = 1;
  for (long long int k = 1; k <= i; k++) {
    (f[k] = f[k - 1] * k) %= 1000000007;
  }
}
long long int isprime(long long int n) {
  if (n == 1) return 0;
  for (long long int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return 0;
  return 1;
}
long long int find(long long int x) {
  if (f[x] == x)
    return x;
  else
    return f[x] = find(f[x]);
}
bool cmp(long long int x, long long int y) { return x < y; }
void check() {
  cout << "HI"
       << "\n";
}
long long int comb(long long int i, long long int j) {
  if (j > i) return 0;
  long long int k = f[i];
  long long int g = (f[j] * (f[i - j])) % 1000000007;
  long long int h = bpow(g, 1000000007 - 2);
  return (k * h) % 1000000007;
}
pair<long double, long double> az(long double a, long double b, long double c,
                                  long double d, long double u) {
  long double x1 = (a - c) * cos(u) - (b - d) * sin(u) + c;
  long double y1 = (a - c) * sin(u) + (b - d) * cos(u) + d;
  return {x1, y1};
}
int main() {
  long long int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int j = 1;
    while (j * 10 <= n) {
      j *= 10;
    }
    long long int u = (n / j) * j;
    u--;
    long long int v = n - u;
    long long int sum = 0;
    while (u > 0) {
      sum += (u % 10);
      u /= 10;
    }
    while (v > 0) {
      sum += (v % 10);
      v /= 10;
    }
    cout << sum << "\n";
  }
}

```