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 ≤ 200 000, 1 ≤ t ≤ 10^9) — 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.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Dynamic programming

Implementation


Solutions:
(n, t) = map(int, input().split())
x = input()
i = x.find('.')
for j in range(i + 1, n):
	if x[j] > '4':
		for k in range(t):
			j -= 1
			if x[j] != '4':
				break
		if j == i:
			j -= 1
			while j and x[j] == '9':
				j -= 1
			x = x[:j] + str(int(x[j]) + 1) + '0' * (i - j - 1)
		else:
			x = x[:j] + str(int(x[j]) + 1)
		break
print(x)


def main():
	(n, t) = map(int, input().split())
	s = input()
	dot = s.find('.')
	for i in range(dot + 1, n):
		if s[i] > '4':
			break
	else:
		print(s)
		return
	while t:
		i -= 1
		t -= 1
		if s[i] < '4':
			break
	if i > dot:
		print(s[:i], chr(ord(s[i]) + 1), sep='')
		return
	else:
		l = list(s[dot - 1::-1])
		for (i, c) in enumerate(l):
			if c == '9':
				l[i] = '0'
			else:
				l[i] = chr(ord(c) + 1)
				break
		else:
			l.append('1')
	print(''.join(reversed(l)))

def __starting_point():
	main()
__starting_point()


def roundroot():
	global root
	i = len(root) - 1
	while i >= 0:
		root[i] += 1
		if root[i] == 10 and i != 0:
			root[i] = 0
			i -= 1
		else:
			break

def printA(a):
	for i in a:
		print(i, end='')
(n, t) = [int(i) for i in input().split()]
num = input()
for i in range(len(num)):
	if num[i] == '.':
		break
root = [int(j) for j in num[:i]]
dec = [int(j) for j in num[i + 1:]]
n = len(dec)
itrack = -1
for i in range(n):
	if dec[i] >= 5:
		itrack = i
		break
if itrack == -1:
	itrack = n - 1
while itrack >= 1 and t > 0:
	if dec[itrack] < 5:
		break
	j = itrack - 1
	t -= 1
	while j >= 0:
		dec[j] += 1
		if dec[j] == 10:
			dec[j] = 0
			j -= 1
		else:
			break
	if j == -1:
		roundroot()
	itrack = j
if itrack >= 0 and t > 0 and (dec[0] >= 5):
	roundroot()
	printA(root)
else:
	printA(root)
	print('.', end='')
	for i in range(itrack + 1):
		print(dec[i], end='')


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
(n, t) = ilele()
num = input()
(a, b) = num.split('.')
Ans = [a]
Ans.append('.')

def fun():
	x = ['0'] + [*a]
	for i in range(len(x) - 1, -1, -1):
		if x[i] == '9':
			x[i] = '0'
		else:
			x[i] = str(int(x[i]) + 1)
			break
	if x[0] == '0':
		for i in range(1, len(x)):
			print(x[i], end='')
	else:
		print(''.join(x))
for i in b:
	Ans.append(i)
	if int(i) >= 5:
		if Ans[-1] == '.':
			fun()
			exit(0)
		else:
			while t > 0:
				t -= 1
				if Ans[-1] == '.':
					fun()
					exit(0)
				if int(Ans[-1]) >= 5:
					Ans.pop()
					if Ans[-1] == '.':
						fun()
						exit(0)
					else:
						Ans[-1] = str(int(Ans[-1]) + 1)
				else:
					break
		break
print(''.join(Ans))


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n
avl = AvlTree()

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(n, k) = map(int, input().split())
r = list(input())
r = ['0'] + r
n += 1
t = r.index('.')
c = 0
stop = 0
for i in range(t + 1, n):
	if r[i] >= '5' and c == 0:
		t1 = 0
		if i - 1 == t:
			t1 = 1
		cou = i - 1 - t1
		while r[cou] == '9':
			if r[cou] == '.':
				cou -= 1
				continue
			r[cou] = '0'
			cou -= 1
		r[cou] = str(int(r[cou]) + 1)
		stop = i - 1 - t1
		break
	elif r[i] == '4':
		if c == 0:
			st = i
		c += 1
	elif c >= 1 and r[i] >= '5':
		if c + 1 <= k:
			t1 = 0
			if st - 1 == t:
				t1 = 1
			cou = st - 1 - t1
			while r[cou] == '9':
				if r[cou] == '.':
					cou -= 1
					continue
				r[cou] = '0'
				cou -= 1
			r[cou] = str(int(r[cou]) + 1)
			stop = st - 1 - t1
		else:
			t1 = 0
			if i - k == t:
				t1 = 1
			cou = i - k - t1
			while r[cou] == '9':
				if r[cou] == '.':
					cou -= 1
					continue
				r[cou] = '0'
				cou -= 1
			r[cou] = str(int(r[cou]) + 1)
			stop = i - k - t1
		break
	elif c >= 1 and r[i] < '5':
		c = 0
	else:
		stop = i
rw = 0
if r[0] == '0':
	rw = 1
print(*r[rw:stop + 1], sep='')


def main():
	(n, t) = map(int, input().split())
	b = list(input())
	p = b.index('.')
	if int(b[p + 1]) > 4:
		del b[p:n]
		b = list(b)
		for x in range(len(b) - 1, -1, -1):
			if b[x] == '9':
				b[x] = '0'
			else:
				b[x] = chr(ord(b[x]) + 1)
				break
		else:
			b.insert(0, '1')
		print(''.join(b))
		return
	else:
		if p + 1 < n - 1:
			for x in range(p + 1, n):
				if int(b[x + 1]) > 4:
					b[x] = chr(ord(b[x]) + 1)
					del b[x + 1:n]
					t -= 1
					break
			else:
				print(''.join(b))
				return
			for y in range(x, p, -1):
				if int(b[y]) < 5 or t == 0:
					break
				elif b[y - 1] != '.':
					b[y - 1] = str(int(b[y - 1]) + 1)
					del b[y:n]
					t -= 1
				elif b[y - 1] == '.':
					del b[y - 1:n]
					b = list(b)
					for x in range(len(b) - 1, -1, -1):
						if b[x] == '9':
							b[x] = '0'
						else:
							b[x] = chr(ord(b[x]) + 1)
							break
					else:
						b.insert(0, '1')
		b = ''.join(b)
	print(b)
main()


(n, t) = map(int, input().split())
mark = input().split('.')
shift = False
fraction = []
for digit in map(int, mark[1]):
	if digit > 4:
		t -= 1
		if fraction:
			fraction[-1] += 1
			while t and fraction and (fraction[-1] > 4):
				t -= 1
				fraction.pop()
				if fraction:
					fraction[-1] += 1
				else:
					shift = True
		else:
			shift = True
		break
	fraction.append(digit)
if shift:
	last_digits = [int(mark[0][-1]) + 1]
	i = -1
	while last_digits[-1] > 9:
		last_digits[-1] -= 10
		i -= 1
		if -i <= len(mark[0]):
			last_digits.append(int(mark[0][i]) + 1)
		else:
			last_digits.append(1)
	print(mark[0][:i], *last_digits[::-1], sep='', end='')
else:
	print(mark[0], end='')
if fraction:
	print('.', *fraction, sep='')


def main():
	(n, t) = map(int, input().split())
	b = input()
	p = b.find('.')
	for i in range(p + 1, n):
		if b[i] > '4':
			break
	else:
		print(b)
		return
	while t:
		i -= 1
		t -= 1
		if b[i] < '4':
			break
	if i > p:
		print(b[:i], chr(ord(b[i]) + 1), sep='')
	else:
		k = list(b[:i])
		for x in range(len(k) - 1, -1, -1):
			if k[x] == '9':
				k[x] = '0'
			else:
				k[x] = chr(ord(k[x]) + 1)
				break
		else:
			k.insert(0, '1')
		print(''.join(k))
main()


from sys import *
input = stdin.readline
(n, t) = map(int, input().split())
num = input()
idx = num.find('.')
if idx < 0:
	print(num)
	exit()
cnt = 1
for i in range(idx + 1, n):
	if num[i] < '5':
		if 5 - int(num[i]) == 1:
			cnt += 1
		else:
			cnt = 1
	if num[i] >= '5':
		j = min(cnt, t)
		if num[i - j] != '.':
			num = num[:i - j] + str(int(num[i - j]) + 1)
		else:
			curr = 0
			while num[idx - curr - 1] == '9' and idx - curr != 0:
				curr += 1
			num = num[:idx - curr - 1] + str(int(num[idx - curr - 1]) + 1) + '0' * curr if curr != idx else '1' + '0' * curr
		break
print(num)


import sys
(n, t) = list(map(int, sys.stdin.readline().split()))
x = sys.stdin.readline()
y = x.find('.')
for i in range(y + 1, n):
	if x[i] > '4':
		for j in range(t):
			i -= 1
			if x[i] != '4':
				break
		if i == y:
			i -= 1
			while i and x[i] == '9':
				i -= 1
			x = x[:i] + str(int(x[i]) + 1) + '0' * (y - i - 1)
		else:
			x = x[:i] + str(int(x[i]) + 1)
		break
print(x)


(n, t) = list(map(int, input().split()))
s = input()
ans = []
te = []
for i in range(len(s)):
	if s[i] == '.':
		for j in range(i + 1, len(s)):
			ans.append(int(s[j]))
		break
	te.append(int(s[i]))
flag = 0
for i in range(len(ans)):
	if ans[i] >= 5:
		flag = 1
		break
if flag == 0:
	print(s)
	return
ans = ans[0:i + 1]
pre = [0 for i in range(len(ans))]
for i in range(1, len(ans)):
	if ans[i - 1] >= 5:
		pre[i] = pre[i - 1] + 1
	else:
		pre[i] = pre[i - 1]
shrink = [0 for i in range(len(ans))]
car = 0
for i in range(len(ans) - 1, -1, -1):
	if i == len(ans) - 1:
		car = 1
		shrink[i] = 1
		t -= 1
	else:
		if car == 1:
			ans[i] += 1
		if ans[i] < 5:
			car = 0
			continue
		elif 5 <= ans[i] <= 9:
			car = 0
			if pre[i] > 0:
				continue
			elif t == 0:
				car = 0
				break
			else:
				t -= 1
				shrink[i] = 1
				car = 1
		else:
			shrink[i] = 1
			car = 1
if car == 1:
	for i in range(len(te) - 1, -1, -1):
		if te[i] == 9 and i > 0:
			te[i] = 0
		elif te[i] < 9:
			te[i] += 1
			car = 0
			break
if car == 1:
	te = [1] + [0] * len(te)
x = shrink.index(1)
if x == 0:
	print(''.join(map(str, te)))
	return
else:
	ans = ans[0:x]
	print(''.join(map(str, te)) + '.' + ''.join(map(str, ans)))


(n, t) = map(int, input().split())
tmp = input()
s = []
for i in range(n):
	s.append(tmp[i])
ind = n
perenos = 0
for i in range(n):
	if s[i] == '.':
		nach = i + 1
for i in range(nach, n):
	if int(s[i]) > 4:
		ind = i
		break
if ind == n:
	print(*s, sep='')
	exit()
while t > 0 and s[ind] != '.':
	if int(s[ind]) > 3:
		ind -= 1
		perenos = 1
		t -= 1
		if s[ind] == '9':
			t += 1
	else:
		s[ind] = str(int(s[ind]) + 1)
		perenos = 0
		break
if s[ind] == '.':
	ind -= 1
	while s[ind] == '9':
		s[ind] = '0'
		ind -= 1
	if ind < 0 and perenos != 0:
		print(1, end='')
		viv = 0
		while s[viv] != '.':
			print(s[viv], end='')
			viv += 1
	else:
		s[ind] = str(int(s[ind]) + perenos)
		viv = 0
		while s[viv] != '.':
			print(s[viv], end='')
			viv += 1
else:
	while s[ind] == '9' or s[ind] == '.':
		if s[ind] == '.':
			ind -= 1
			continue
		s[ind] = '0'
		ind -= 1
	s[ind] = str(int(s[ind]) + perenos)
	for i in range(ind + 1):
		print(s[i], end='')


(n, t) = map(int, input().split())
s = '0' + input()
f = s.find('.')
if f == -1:
	print(s[1:])
	exit(0)
r = list(s[:f] + s[f + 1:])
for i in range(f, len(r)):
	if r[i] >= '5' and r[i] <= '9':
		while r[i] >= '5' and r[i] <= '9':
			if i < f or t <= 0:
				break
			i -= 1
			z = ord(r[i]) + 1
			while z == ord('9') + 1:
				i -= 1
				z = ord(r[i]) + 1
			while len(r) != i + 1:
				r.pop()
			r[-1] = chr(z)
			t -= 1
		break
if r[0] == '0':
	r = r[1:]
	f -= 1
r += ['0'] * max(f - len(r), 0)
if len(r) == f:
	print(*r, sep='')
else:
	print(*r[:f], '.', *r[f:], sep='')


(n, t) = map(int, input().split())
s = input()
ind = s.find('.')
for i in range(ind + 1, n):
	if s[i] > '4':
		break
else:
	print(s)
	quit()
while t:
	t -= 1
	i -= 1
	if s[i] < '4':
		break
if i > ind:
	print(s[:i], chr(ord(s[i]) + 1), sep='')
else:
	t = list(s[:i])
	for i in range(len(t) - 1, -1, -1):
		if t[i] == '9':
			t[i] = '0'
		else:
			t[i] = chr(ord(t[i]) + 1)
			break
	else:
		t.insert(0, '1')
	print(''.join(t))


(n, t) = list(map(int, input().split()))
num = input()
idx = num.index('.')
cnt = 1
for i in range(idx + 1, n):
	if num[i] < '5':
		if 5 - int(num[i]) == 1:
			cnt += 1
		else:
			cnt = 1
	if num[i] >= '5':
		j = min(cnt, t)
		if num[i - j] != '.':
			num = num[:i - j] + str(int(num[i - j]) + 1)
		else:
			curr = 0
			while num[idx - curr - 1] == '9' and idx - curr != 0:
				curr += 1
			num = num[:idx - curr - 1] + str(int(num[idx - curr - 1]) + 1) + '0' * curr if curr != idx else '1' + '0' * curr
		break
print(num)


(a, b) = map(int, input().split())
c = input()
clock = c.find('.')
for x in range(clock + 1, a):
	if c[x] > '4':
		break
else:
	x = a
	print(c)
if x != a:
	while b:
		x -= 1
		b -= 1
		if c[x] != '4':
			break
	if x > clock:
		print(c[:x], chr(ord(c[x]) + 1), sep='')
	else:
		c = list(c[:x])
		x -= 1
		while x >= 0:
			if c[x] == '9':
				c[x] = '0'
				x -= 1
			else:
				c[x] = chr(ord(c[x]) + 1)
				break
		else:
			c.insert(0, '1')
		print(''.join(c))


(n, t) = map(int, input().split())
s = input()
(pp, ap) = s.split('.')
pp = list(map(int, pp))
for (i, c) in enumerate(map(int, ap)):
	if c >= 5:
		break
t -= 1
rnd = len(ap)
if c >= 5:
	rnd = i - 1
	while t > 0 and rnd >= 0 and (int(ap[rnd]) + 1 >= 5):
		rnd -= 1
		t -= 1
if rnd == -1:
	i = len(pp) - 1
	while i >= 0:
		pp[i] += 1
		if pp[i] > 9:
			pp[i] -= 10
			i -= 1
		else:
			break
	if i < 0:
		pp.insert(0, 1)
ap = list(map(int, ap))
if 0 <= rnd < len(ap):
	ap[rnd] += 1
if rnd >= 0:
	print(''.join(map(str, pp)), '.', ''.join(map(str, ap[:rnd + 1])), sep='')
else:
	print(''.join(map(str, pp)))


(n, t) = list(map(int, input().split()))
s = list(input())
p = 0
index = n - 1
for i in range(0, n):
	if s[i] == '.':
		p = i
	if p == 0:
		continue
	if s[i] >= '5':
		index = i
		break
while s[index] >= '5' and index > p and (t > 0):
	if s[index - 1] == '.':
		index = index - 1
		break
	index = index - 1
	s[index] = str(int(s[index]) + 1)
	t = t - 1
flag = 0
if p == index:
	flag = 1
	index = index - 1
	while index >= 0 and flag != 0:
		if s[index] == '9':
			s[index] = '0'
			flag = 1
		else:
			s[index] = str(int(s[index]) + 1)
			flag = 0
		index = index - 1
	index = p - 1
if flag != 0:
	print(1, end='')
for i in range(0, index + 1):
	print(s[i], end='')
print('')


__author__ = 'Think'

def plus(s, n=1):
	if len(s) > n:
		route = s[-n] == '9' or (s[-1 - n] == '9' and s[-n] == '.')
	else:
		route = s[-n] == '9'
	if route:
		s = s[:-n] + s[-n]
		broken = False
		count = 0
		passed = False
		for i in range(len(s) - 1, -1, -1):
			if s[i] == '.':
				passed = True
			elif s[i] == '9':
				if passed:
					count += 1
			else:
				broken = True
				break
		if not broken:
			return '1' + '0' * count
		else:
			return s[:i] + chr(ord(s[i]) + 1) + '0' * count
	else:
		if s[-n] == '.':
			n += 1
		return s[:-n] + chr(ord(s[-n]) + 1)
(n, t) = [int(i) for i in input().split()]
default = input()
(new, frac) = default.split('.')
new += '.'
fours = False
done = False
for i in range(len(frac)):
	s = frac[i]
	if ord(s) > 52:
		if not fours:
			print(plus(new))
		else:
			print(plus(new, min(t, counter + 1)))
		done = True
		break
	elif ord(s) == 52:
		if not fours:
			fours = True
			counter = 0
		counter += 1
	elif fours:
		fours = False
	new += s
if not done:
	print(default)


R = lambda : map(int, input().split())
(n, t) = R()
s = list(input())
r = -1
l = s.index('.') + 1
for i in range(l, n):
	if s[i] >= '5':
		r = i
		break
for i in range(r, max(l - 1, r - t), -1):
	if s[i] >= '5':
		if i - 1 != l - 1:
			s[i - 1] = str((int(s[i - 1]) + 1) % 10)
			r = i - 1
		else:
			s[i - 2] = str((int(s[i - 2]) + 1) % 10)
			r = l - 2
			if s[r] == '0':
				for j in range(r - 1, -1, -1):
					if s[j] == '9':
						s[j] = '0'
					else:
						s[j] = str((int(s[j]) + 1) % 10)
						break
				if s[0] == '0':
					s = ['1'] + s
					r += 1
print(''.join(s[:r + 1]) if r >= 0 else ''.join(s))


import sys
from decimal import *
(n, t) = map(int, input().split())
x = input()
i = x.find('.')
if 0 > i:
	print(x)
	sys.exit()
if 1 > i:
	i = 1
	n += 1
	x = '0' + x
for j in range(1 + i, n):
	if '4' < x[j]:
		break
else:
	print(x)
	sys.exit()
while 0 < t:
	j -= 1
	if '4' != x[j]:
		break
	t -= 1
getcontext().prec = 1 + j
x = pow(Decimal(10), i - j) + Decimal(x[:1 + j])
print(x if x != x.to_integral_value() else x.quantize(Decimal(1)))


(n, k) = map(int, input().split())
s = list(input())
dot = s.index('.')
pos = -1
for i in range(dot + 1, n):
	if s[i] > '4':
		pos = i
		break
if pos < 0:
	print(''.join(s))
else:
	for j in range(k):
		if s[pos - 1 - j] != '4':
			break
	pos = pos - 1 - j
	while pos >= 0 and (s[pos] == '9' or pos == dot):
		pos -= 1
	if pos < 0:
		print('1', end='')
		print('0' * dot)
	elif pos < dot:
		print(''.join(s[:pos]), end='')
		print(chr(ord(s[pos]) + 1), end='')
		print('0' * (dot - pos - 1))
	else:
		print(''.join(s[:pos]), end='')
		print(chr(ord(s[pos]) + 1))


(n, t) = [int(x) for x in input().split()]
(a, s) = input().split('.')
s = list(s)
pos = len(s) - 1
for i in range(len(s)):
	if ord(s[i]) > ord('4'):
		pos = i
		break
while t > 0 and pos > 0:
	if ord(s[pos]) > ord('4'):
		pos -= 1
		s[pos] = chr(ord(s[pos]) + 1)
		t -= 1
	else:
		break
if t > 0 and pos == 0 and (s[0] > '4'):
	it = len(a) - 1
	A = [ord(ch) - ord('0') for ch in a]
	A[it] += 1
	while it > 0:
		if A[it] == 10:
			A[it] = 0
			A[it - 1] += 1
			it -= 1
		else:
			break
	res = ''.join([str(x) for x in A])
	print(res)
else:
	res = a + '.' + ''.join(s[:pos + 1])
	print(res)


(n, t) = map(int, input().split(' '))
num = input()
num = ['0'] + list(num)
stack = []
dot = num.index('.')
for (i, x) in enumerate(num):
	if i > dot and int(x) >= 5:
		stack.append(i)
		break
ind = len(num) - 1
for i in range(t):
	if len(stack) == 0 or stack[0] < dot:
		break
	ind = stack[0]
	while True:
		ind -= 1
		if num[ind] == '.':
			ind -= 1
		tmp = int(num[ind]) + 1
		if tmp < 10:
			num[ind] = str(tmp)
			break
		else:
			num[ind] = '0'
	stack.pop()
	if int(num[ind]) >= 5:
		stack.append(ind)
num = num[:max(ind + 1, dot)]
if num[0] == '0':
	num = num[1:]
print(''.join(num))