Square root
To find the square root of a decimal fraction (for example, 65432.109), start by dividing the number into groups of two digits each, both to the left and right of the decimal point. The leftmost group may contain just one digit (e.g., 6). Identify the first digit of the square root (2) as the largest digit whose square does not exceed the first group (6). Subtract the square of this digit (4) from the first group, and append the next group (54) to the right of the result. To the left of this new number (254), write twice the first digit of the root (4), and choose the next digit (5) as the largest digit whose product with the number formed by appending it to the doubled first digit (45 ∙ 5 = 225) does not exceed the current number (254). This digit (5) is then added to the root, and the process continues. The decimal point in the root is placed when the first group to the right of the decimal point is appended.
Write a program that computes the square root of a positive decimal fraction.
Input
The input consists of a single line containing a finite or periodic positive decimal fraction a (up to 1000 characters including the decimal point) and a natural number n, which does not exceed 100.
Output
Output a single line representing the square root of a as a finite or periodic decimal fraction, if possible. Otherwise, provide the square root of a with precision up to n digits after the decimal point.