Long Beautiful Integer

TimeLimit:3000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

You are given an integer x of n digits a1,a2,…,an, which make up its decimal notation in order from left to right.


Also, you are given a positive integer k<n.


Let's call integer b1,b2,…,bm beautiful if bi=bi+k for each i, such that 1≤i≤m−k.


You need to find the smallest beautiful integer y, such that y≥x.


Input

The first line of input contains two integers n,k (2≤n≤200000,1≤k<n): the number of digits in x and k.


The next line of input contains n digits a1,a2,…,an (a1≠0, 0≤ai≤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 b1,b2,…,bm (b1≠0, 0≤bi≤9): digits of y.


SampleInput 1
3 2
353
SampleOutput 1
3
353
SampleInput 2
4 2
1234
SampleOutput 2
4
1313
Submit
题目统计信息详细
总AC数3
通过人数3
尝试人数4
总提交量25
AC率12.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: