Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Sum

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputVasya 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 *FF*_{16}, in the base 15 positional notation it is equal to 110_{15}, in the base 10 one — to 165_{10}, in the base 9 one — to 176_{9}, 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 (110_{15}), base 10 (165_{10}), base 9 (176_{9}) 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

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/22/2019 06:40:53 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|