Codeforces Beta Round 46 (Div. 2)
B
Sum
Codeforces
1500
原题
← AC →
翻译中…

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 $*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.

翻译中…

样例

Input #1
78 87
Output #1
3
InputCopy OutputCopy
Input #2
1 1
Output #2
2
InputCopy OutputCopy
题目信息
题号
49B
时间限制
2 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。