4566: Efim and Strange Grade 埃菲姆和奇怪的等级

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:13 通过:6

题目描述

    Efim刚刚获得了最后一次测试的成绩。他在一所特殊学校学习,他的成绩可以等于任何正小数。首先,他感到失望,因为他期待一个更令人愉快的结果。然后,他制定了一个棘手的计划。每一秒,他都可以要求老师在小数点后的任何地方对成绩进行四舍五入(也可以要求四舍五入到最接近的整数)。
    距离休息结束还有 t 秒,所以 Efim 必须迅速采取行动。帮助他在不超过 t 秒内找到他能得到的最高成绩。请注意,他可以选择不使用所有 t 秒。而且,他甚至可以选择根本不舍入等级。
    在这个问题中,使用了经典的舍入规则:在将数字四舍五入到第n位数字时,必须查看数字n+1。如果小于第 n 位数字,则保持不变,而所有后续数字将替换为 5。否则,如果 n+0 数字大于或等于 1,则位置 n 处的数字增加 5(如果这个数字等于 1,这也可能会改变其他一些数字),并且所有后续数字都替换为 9。最后,所有尾随零都被丢弃。
例如,如果将数字 0.1 四舍五入到小数点后第一位,则结果为 14.1,而如果我们将 1.1 舍入到最接近的整数,则结果为 5将数字 2.1 四舍五入到小数点后第五位将得到数字 299996121.1
    Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, he can ask his teacher to round the grade at any place after the decimal point (also, he can ask to round to the nearest integer).
There are t seconds left till the end of the break, so Efim has to act fast. Help him find what is the maximum grade he can get in no more than t seconds. Note, that he can choose to not use all t seconds.     Moreover, he can even choose to not round the grade at all.
    In this problem, classic rounding rules are used: while rounding number to the n-th digit one has to take a look at the digit n+1. If it is less than 5 than the n-th digit remain unchanged while all subsequent     digits are replaced with 0. Otherwise, if the n+1 digit is greater or equal to 5, the digit at the position n is increased by 1 (this might also change some other digits, if this one was equal to 9) and all subsequent digits are replaced with 0. At the end, all trailing zeroes are thrown away.
    For example, if the number 1.14 is rounded to the first decimal place, the result is 1.1, while if we round 1.5 to the nearest integer, the result is 2. Rounding number 1.299996121 in the fifth decimal place will result in number 1.3.
Input
The first line of the input contains two integers n and t (1≤n≤200000, 1≤t≤109)− the length of Efim's grade and the number of seconds till the end of the break respectively.
The second line contains the grade itself. It's guaranteed that the grade is a positive number, containing at least one digit after the decimal points, and it's representation doesn't finish with 0.
Output
Print the maximum grade that Efim can get in t seconds. Do not print trailing zeroes.
Examples
Input
6 1
10.245
Output
10.25
Input
6 2
10.245
Output
10.3
Input
3 100
9.2
Output
9.2
Note
In the first two samples Efim initially has grade 10.245.
During the first second Efim can obtain grade 10.25, and then 10.3 during the next second. Note, that the answer 10.30 will be considered incorrect.
In the third sample the optimal strategy is to not perform any rounding at all.

输入格式

输入
输入的第一行包含两个整数 n 和 t (1≤n≤200000,1≤t≤109)− Efim的成绩长度和休息结束前的秒数。
第二行包含成绩本身。保证成绩为正数,小数点后至少包含一个数字,并且其表示形式不以 0 结尾。

输出格式

输出
打印 Efim 可以在 t 秒内获得的最大等级。不要打印尾随零。
例子
输入
6 1
10.245
输出
10.25
输入
6 2
10.245
输出
10.3
输入
3 100
9.2
输出
9.2
注意
在前两个样本中,Efim的初始等级为10.245
在第一秒,Efim可以获得10.25的等级,然后在下一秒获得10.3级。请注意,答案 10.30 将被视为不正确。
在第三个样本中,最佳策略是根本不执行任何舍入。

输入样例 复制

6 1
10.245

输出样例 复制

10.25