{"raw_statement":[{"iden":"problem statement","content":"You are given a string $S$ of length $N$ and a string $T$ of length $M$, both consisting of digits from `1` to `9`.\nYou will perform the following operation for $k=1,2,\\ldots,M$ in order:\n\n*   Choose an integer $i$ such that $1 \\le i \\le N$. Then, replace the $i$\\-th character of $S$ with the $k$\\-th character of $T$.\n\nFind the maximum possible value of the resulting string $S$ interpreted as an integer after performing the $M$ operations."},{"iden":"constraints","content":"*   $1 \\le N,M \\le 10^6$\n*   $N$ and $M$ are integers.\n*   $S$ is a string of length $N$ consisting of digits from `1` through `9`.\n*   $T$ is a string of length $M$ consisting of digits from `1` through `9`."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$S$\n$T$"},{"iden":"sample input 1","content":"3 3\n191\n325"},{"iden":"sample output 1","content":"593\n\nThe following sequence of operations is optimal:\n\n*   For $k=1$: Choose $i=3$. Then, $S =$ `193`.\n*   For $k=2$: Choose $i=1$. Then, $S =$ `293`.\n*   For $k=3$: Choose $i=1$. Then, $S =$ `593`.\n\nIn this case, the value of $S$ interpreted as an integer is $593$, which is the maximum."},{"iden":"sample input 2","content":"3 9\n191\n998244353"},{"iden":"sample output 2","content":"993"},{"iden":"sample input 3","content":"11 13\n31415926535\n2718281828459"},{"iden":"sample output 3","content":"98888976555"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}