#include <bits/stdc++.h>
const long long kot = LLONG_MAX;
using kk = long double;
const long long int alpha = 1e18;
using namespace std;
long long int gcd(long long int a, long long int begin) {
  if (a == 0) return begin;
  if (begin == 0) return a;
  if (a == begin) return a;
  if (a > begin) return gcd(a - begin, begin);
  return gcd(a, begin - a);
}
long long int largest(long long int arr[], long long int n) {
  return *max_element(arr, arr + n);
}
long long int lcm(long long int a, long long int begin) {
  return (a * begin) / gcd(a, begin);
}
void sieve(bool primes[], long long int x) {
  primes[1] = false;
  for (long long int i = 2; i * i <= x; i++) {
    if (primes[i] == true) {
      for (long long int j = 2; j * i <= x; j++) primes[i * j] = false;
    }
  }
}
long long int power(long long int x, unsigned long long int y,
                    long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
class gfg {
 public:
  long long int sumDigits(long long int no) {
    return no == 0 ? 0 : no % 10 + sumDigits(no / 10);
  }
};
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool comp(long long int a, long long int begin) { return (a < begin); }
vector<long long int> ve;
void divisors(long long int n) {
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        ve.push_back(i);
      else
        ve.push_back(i);
      ve.push_back(n / i);
    }
  }
}
bool isPrime(long long int n) {
  if (n == 1) {
    return false;
  }
  long long int i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      return false;
    }
    i += 1;
  }
  return true;
}
long long int gcdofarray(vector<long long int>& v, long long int n) {
  long long int result = v[0];
  for (long long int i = 1; i < n; i++) result = gcd(v[i], result);
  return result;
}
long long int sumofdigits(long long int n) {
  long long int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
bool powertwo(long long int x) { return x && (!(x & (x - 1))); }
long long int finduncommonsubsequence(string str, string s) {
  if (!str.compare(s)) {
    return 0;
  }
  return max(str.length(), s.length());
}
void reversec(string str) {
  for (long long int i = str.length() - 1; i >= 0; i--) cout << str[i];
}
string removeDuplicatesFromString(string str) {
  long long int counter = 0;
  long long int i = 0;
  long long int size = str.size();
  long long int x;
  long long int length = 0;
  while (i < size) {
    x = str[i] - 97;
    if ((counter & (1 << x)) == 0) {
      str[length] = 'a' + x;
      counter = counter | (1 << x);
      length++;
    }
    i++;
  }
  return str.substr(0, length);
}
long long int commDiv(long long int a, long long int begin) {
  long long int n = gcd(a, begin);
  long long int result = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        result += 1;
      else
        result += 2;
    }
  }
  return result;
}
long long int fact(long long int n) {
  if (n <= 1) return 1;
  return n * fact(n - 1);
}
long long int nPr(long long int n, long long int r) {
  return fact(n) / fact(n - r);
}
long long int kash(long long int a, long long int begin) {
  return (a * begin) / gcd(a, begin);
}
long long int maxi(long long int a, long long int begin) {
  return (a > begin) ? a : begin;
}
long long int mini(long long int a, long long int begin) {
  return (a < begin) ? a : begin;
}
long long int nCr(long long int n, long long int r) {
  return fact(n) / (fact(r) * fact(n - r));
}
long long int nCrModp(long long int n, long long int r, long long int p) {
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int powi(long long int begin, long long int p) {
  if (!p) return 1;
  long long int sq = powi(begin, p / 2);
  sq *= sq;
  if (p % 2) sq *= begin;
  return sq;
}
long long int val(char c) {
  if (c >= '0' && c <= '9')
    return (long long int)c - '0';
  else
    return (long long int)c - 'A' + 10;
}
long long int baseToDecimal(long long int base, long long int x) {
  long long int num = 0;
  long long int i = 0;
  while (x) {
    num += powi(base, i) * (x % 10);
    i++;
    x /= 10;
  }
  return num;
}
string kas(long long int base, long long int x) {
  string str = "";
  while (x) {
    str += (char(x % base + '0'));
    x /= base;
  }
  reverse(str.begin(), str.end());
  return str;
}
void solve() {
  long long int t = 1;
  while (t--) {
    long long int a, begin;
    cin >> a >> begin;
    string s = to_string(a);
    string t = to_string(begin);
    long long int maxu = s[0] - '0';
    long long int i;
    for (i = 0; s[i]; i++) {
      maxu = maxi(maxu, s[i] - '0');
    }
    for (i = 0; t[i]; i++) {
      maxu = maxi(maxu, t[i] - '0');
    }
    maxu++;
    a = baseToDecimal(maxu, a);
    begin = baseToDecimal(maxu, begin);
    a += begin;
    cout << (kas(maxu, a).size()) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

Vasya studies positional numeral systems. Unfortunately, he often forgets to write the base of notation in which the expression is written. Once he saw a note in his notebook saying a + b = ?, and that the base of the positional notation wasn’t written anywhere. Now Vasya has to choose a base p and regard the expression as written in the base p positional notation. Vasya understood that he can get different results with different bases, and some bases are even invalid. For example, expression 78 + 87 in the base 16 positional notation is equal to FF16, in the base 15 positional notation it is equal to 11015, in the base 10 one — to 16510, in the base 9 one — to 1769, and in the base 8 or lesser-based positional notations the expression is invalid as all the numbers should be strictly less than the positional notation base. Vasya got interested in what is the length of the longest possible expression value. Help him to find this length.

The length of a number should be understood as the number of numeric characters in it. For example, the length of the longest answer for 78 + 87 = ? is 3. It is calculated like that in the base 15 (11015), base 10 (16510), base 9 (1769) positional notations, for example, and in some other ones.

Input

The first letter contains two space-separated numbers a and b (1 ≤ a, b ≤ 1000) which represent the given summands.

Output

Print a single number — the length of the longest answer.

Examples

Input

78 87


Output

3


Input

1 1


Output

2

### Response

```cpp
#include <bits/stdc++.h>
const long long kot = LLONG_MAX;
using kk = long double;
const long long int alpha = 1e18;
using namespace std;
long long int gcd(long long int a, long long int begin) {
  if (a == 0) return begin;
  if (begin == 0) return a;
  if (a == begin) return a;
  if (a > begin) return gcd(a - begin, begin);
  return gcd(a, begin - a);
}
long long int largest(long long int arr[], long long int n) {
  return *max_element(arr, arr + n);
}
long long int lcm(long long int a, long long int begin) {
  return (a * begin) / gcd(a, begin);
}
void sieve(bool primes[], long long int x) {
  primes[1] = false;
  for (long long int i = 2; i * i <= x; i++) {
    if (primes[i] == true) {
      for (long long int j = 2; j * i <= x; j++) primes[i * j] = false;
    }
  }
}
long long int power(long long int x, unsigned long long int y,
                    long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
class gfg {
 public:
  long long int sumDigits(long long int no) {
    return no == 0 ? 0 : no % 10 + sumDigits(no / 10);
  }
};
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool comp(long long int a, long long int begin) { return (a < begin); }
vector<long long int> ve;
void divisors(long long int n) {
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        ve.push_back(i);
      else
        ve.push_back(i);
      ve.push_back(n / i);
    }
  }
}
bool isPrime(long long int n) {
  if (n == 1) {
    return false;
  }
  long long int i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      return false;
    }
    i += 1;
  }
  return true;
}
long long int gcdofarray(vector<long long int>& v, long long int n) {
  long long int result = v[0];
  for (long long int i = 1; i < n; i++) result = gcd(v[i], result);
  return result;
}
long long int sumofdigits(long long int n) {
  long long int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
bool powertwo(long long int x) { return x && (!(x & (x - 1))); }
long long int finduncommonsubsequence(string str, string s) {
  if (!str.compare(s)) {
    return 0;
  }
  return max(str.length(), s.length());
}
void reversec(string str) {
  for (long long int i = str.length() - 1; i >= 0; i--) cout << str[i];
}
string removeDuplicatesFromString(string str) {
  long long int counter = 0;
  long long int i = 0;
  long long int size = str.size();
  long long int x;
  long long int length = 0;
  while (i < size) {
    x = str[i] - 97;
    if ((counter & (1 << x)) == 0) {
      str[length] = 'a' + x;
      counter = counter | (1 << x);
      length++;
    }
    i++;
  }
  return str.substr(0, length);
}
long long int commDiv(long long int a, long long int begin) {
  long long int n = gcd(a, begin);
  long long int result = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        result += 1;
      else
        result += 2;
    }
  }
  return result;
}
long long int fact(long long int n) {
  if (n <= 1) return 1;
  return n * fact(n - 1);
}
long long int nPr(long long int n, long long int r) {
  return fact(n) / fact(n - r);
}
long long int kash(long long int a, long long int begin) {
  return (a * begin) / gcd(a, begin);
}
long long int maxi(long long int a, long long int begin) {
  return (a > begin) ? a : begin;
}
long long int mini(long long int a, long long int begin) {
  return (a < begin) ? a : begin;
}
long long int nCr(long long int n, long long int r) {
  return fact(n) / (fact(r) * fact(n - r));
}
long long int nCrModp(long long int n, long long int r, long long int p) {
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int powi(long long int begin, long long int p) {
  if (!p) return 1;
  long long int sq = powi(begin, p / 2);
  sq *= sq;
  if (p % 2) sq *= begin;
  return sq;
}
long long int val(char c) {
  if (c >= '0' && c <= '9')
    return (long long int)c - '0';
  else
    return (long long int)c - 'A' + 10;
}
long long int baseToDecimal(long long int base, long long int x) {
  long long int num = 0;
  long long int i = 0;
  while (x) {
    num += powi(base, i) * (x % 10);
    i++;
    x /= 10;
  }
  return num;
}
string kas(long long int base, long long int x) {
  string str = "";
  while (x) {
    str += (char(x % base + '0'));
    x /= base;
  }
  reverse(str.begin(), str.end());
  return str;
}
void solve() {
  long long int t = 1;
  while (t--) {
    long long int a, begin;
    cin >> a >> begin;
    string s = to_string(a);
    string t = to_string(begin);
    long long int maxu = s[0] - '0';
    long long int i;
    for (i = 0; s[i]; i++) {
      maxu = maxi(maxu, s[i] - '0');
    }
    for (i = 0; t[i]; i++) {
      maxu = maxi(maxu, t[i] - '0');
    }
    maxu++;
    a = baseToDecimal(maxu, a);
    begin = baseToDecimal(maxu, begin);
    a += begin;
    cout << (kas(maxu, a).size()) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
}

```