Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

В условии задачи недавно были сделаны правки. Просмотреть изменения.

×
C. Fancy Number

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA car number in Berland consists of exactly *n* digits. A number is called beautiful if it has at least *k* equal digits. Vasya wants to change the digits in his car's number so that the number became beautiful. To replace one of *n* digits Vasya has to pay the sum of money, equal to the absolute difference between the old digit and the new one.

Help Vasya: find the minimum sum of money he should pay to make the number of his car beautiful. You should also find the resulting beautiful number. If there are several such numbers, then print the lexicographically minimum one.

Input

The first line contains two space-separated integers *n* and *k* (2 ≤ *n* ≤ 10^{4}, 2 ≤ *k* ≤ *n*) which represent how many digits the number has and how many equal digits a beautiful number should have. The second line consists of *n* digits. It describes the old number of Vasya's car. It is guaranteed that the number contains no spaces and only contains digits.

Output

On the first line print the minimum sum of money Vasya needs to change the number. On the second line print the car's new number. If there are several solutions, print the lexicographically minimum one.

Examples

Input

6 5

898196

Output

4

888188

Input

3 2

533

Output

0

533

Input

10 6

0001112223

Output

3

0000002223

Note

In the first sample replacing the second digit with an "8" costs |9 - 8| = 1. Replacing the fifth digit with an "8" costs the same. Replacing the sixth digit costs |6 - 8| = 2. As a result, Vasya will pay 1 + 1 + 2 = 4 for a beautiful number "888188".

The lexicographical comparison of strings is performed by the < operator in modern programming languages. The string *x* is lexicographically smaller than the string *y*, if there exists such *i* (1 ≤ *i* ≤ *n*), that *x*_{i} < *y*_{i}, and for any *j* (1 ≤ *j* < *i*) *x*_{j} = *y*_{j}. The strings compared in this problem will always have the length *n*.

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/29/2020 21:09:36 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|