AtCoder Regular Contest 131
A
Two Lucky Numbers
AtCoder
⌀ 0
原题
←B →
翻译中…

Problem Statement

翻译中…

Mr. AtCoder reads in the newspaper that today's lucky number is a positive integer $A$ and tomorrow's is a positive integer $B$.

翻译中…

Here, he defines a positive integer $x$ that satisfies both of the following conditions as a super-lucky number.

翻译中…
  • The decimal notation of $x$ contains $A$ as a contiguous substring.
  • The decimal notation of $2x$ contains $B$ as a contiguous substring.
翻译中…

Actually, under the Constraints of this problem, there is always a super-lucky number less than $10^{18}$. Find one such number.

翻译中…

Constraints

翻译中…
  • $1 \leq A < 10^8$
  • $1 \leq B < 10^8$
  • $A$ and $B$ have no leading 0s.
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

A
B

翻译中…

Output

翻译中…

Print one super-lucky number less than $10^{18}$. If multiple solutions exist, you may print any of them.

翻译中…

样例

Input #1
13
62
Output #1
131
One super-lucky number is $x = 131$, because: - $x = 131$ contains $13$ as a substring. ($1$-st through $2$-nd characters) - $2x = 262$ contains $62$ as a substring. ($2$-nd through $3$-rd characters) Some other super-lucky numbers are $313$, $8135$, and $135797531$, which would also be accepted.
Input #2
69120
824
Output #2
869120
One super-lucky number is $x = 869120$, because: - $x = 869120$ contains $69120$ as a substring. ($2$-nd through $6$-th characters) - $2x = 1738240$ contains $824$ as a substring. ($4$-th through $6$-th characters) The smallest super-lucky number is $69120$, but note that any lucky number with at most $18$ digits would be accepted.
Input #3
6283185
12566370
Output #3
6283185
When $x = 6283185$, $x$ is $A$ itself, and $2x$ is $B$ itself. In such a case too, $x$ is a super-lucky number.
题目信息
题号
arc131_a
时间限制
2 s
内存限制
1024 MB

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