AtCoder Regular Contest 154
A
Swap Digit
AtCoder
⌀ 364
原题
←B →
翻译中…

Problem Statement

翻译中…

You are given $N$-digit positive integers $A$ and $B$ whose topmost digits are not $0$.

翻译中…

You can repeat the following operation any number of times (possibly zero).

翻译中…
  • Choose an integer $i$ such that $1 \le i \le N$ and swap the $i$-th lowest digits of $A$ and $B$.
翻译中…

Find the smallest possible value of $A \times B$ after your operations, modulo $998244353$.

翻译中…

Note that you are not asked to minimize the remainder when $A \times B$ is divided by $998244353$.

翻译中…

Constraints

翻译中…
  • $1 \le N \le 200000$
  • $A$ and $B$ are $N$-digit positive integers whose topmost digits are not $0$.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
A
B

翻译中…

Output

翻译中…

Print a single line containing the answer.

翻译中…

样例

Input #1
2
13
22
Output #1
276
You can make $A \times B = 276$ by performing the operation once, as follows. - Choose $i=1$ to swap the bottommost digits of $A$ and $B$, making $A=12, B=23$. You cannot make $A \times B = 275$ or less, so the answer is $276$.
Input #2
8
20220122
21002300
Output #2
54558365
Find the value modulo $998244353$.
题目信息
题号
arc154_a
时间限制
2 s
内存限制
1024 MB

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