Codeforces Round 609 (Div. 2)
C
Long Beautiful Integer
Codeforces
未评级
原题
← BD →
翻译中…

You are given an integer $x$ of $n$ digits $a_1, a_2, \ldots, a_n$, which make up its decimal notation in order from left to right.

翻译中…

Also, you are given a positive integer $k \lt n$.

翻译中…

Let's call integer $b_1, b_2, \ldots, b_m$ beautiful if $b_i = b_{i+k}$ for each $i$, such that $1 \leq i \leq m - k$.

翻译中…

You need to find the smallest beautiful integer $y$, such that $y \geq x$.

翻译中…

Input

翻译中…

The first line of input contains two integers $n, k$ ($2 \leq n \leq 200\,000, 1 \leq k \lt n$): the number of digits in $x$ and $k$.

翻译中…

The next line of input contains $n$ digits $a_1, a_2, \ldots, a_n$ ($a_1 \neq 0$, $0 \leq a_i \leq 9$): digits of $x$.

翻译中…

Output

翻译中…

In the first line print one integer $m$: the number of digits in $y$.

翻译中…

In the next line print $m$ digits $b_1, b_2, \ldots, b_m$ ($b_1 \neq 0$, $0 \leq b_i \leq 9$): digits of $y$.

翻译中…

样例

Input #1
3 2
353
Output #1
3
353
InputCopy OutputCopy
Input #2
4 2
1234
Output #2
4
1313
InputCopy OutputCopy
题目信息
题号
1269C
时间限制
3 s
内存限制
256 MB

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