Yandex.Algorithm 2011: Round 2
A
Reflection
Codeforces
1600
原题
←B →
翻译中…

For each positive integer $*n*$ consider the integer $ψ(*n*)$ which is obtained from $*n*$ by replacing every digit $*a*$ in the decimal notation of $*n*$ with the digit $(9  -  *a*)$. We say that $ψ(*n*)$ is the reflection of $*n*$. For example, reflection of $192$ equals $807$. Note that leading zeros (if any) should be omitted. So reflection of $9$ equals $0$, reflection of $91$ equals $8$.

翻译中…

Let us call the weight of the number the product of the number and its reflection. Thus, the weight of the number $10$ is equal to $10·89 = 890$.

翻译中…

Your task is to find the maximum weight of the numbers in the given range $[*l*, *r*]$ (boundaries are included).

翻译中…

Input

翻译中…

Input contains two space-separated integers $*l*$ and $*r*$ ($1 ≤ *l* ≤ *r* ≤ 10^{9}$) — bounds of the range.

翻译中…

Output

翻译中…

Output should contain single integer number: maximum value of the product $*n*·ψ(*n*)$, where $*l* ≤ *n* ≤ *r*$.

翻译中…

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preferred to use cout (also you may use %I64d).

翻译中…

Note

翻译中…

In the third sample weight of $8$ equals $8·1 = 8$, weight of $9$ equals $9·0 = 0$, weight of $10$ equals $890$.

翻译中…

Thus, maximum value of the product is equal to $890$.

翻译中…

样例

Input #1
3 7
Output #1
20
InputCopy OutputCopy
Input #2
1 1
Output #2
8
InputCopy OutputCopy
Input #3
8 10
Output #3
890
InputCopy OutputCopy
题目信息
题号
86A
时间限制
2 s
内存限制
256 MB
标签
数学

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