eolymp
bolt
Try our new interface for solving problems
Problems

Fractions to Decimals

Fractions to Decimals

Write a program that will accept a fraction of the form \textbf{N}/\textbf{D}, where \textbf{N} is the numerator and \textbf{D} is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, \textbf{1}/\textbf{3} = \textbf{.33333333…} is denoted as\textbf{ 0.}(\textbf{3}), and \textbf{41}/\textbf{333} = \textbf{0.123123123…} is denoted as \textbf{0.}(\textbf{123}). Use \textbf{xxx.0} to denote an integer. Typical conversions are: \begin{verbatim} 1/3 = 0.(3)22/5 = 4.41/7 = 0.(142857)2/2 = 1.03/8 = 0.37545/56 = 0.803(571428)\end{verbatim}\InputFile A single line with two space separated integers, \textbf{N} and \textbf{D}, \textbf{1} ≤ \textbf{N}, \textbf{D} ≤ \textbf{100000}. \OutputFile The decimal expansion, as detailed above. If the expansion exceeds \textbf{76} characters in length, print it on multiple lines with \textbf{76} characters per line.
Time limit 1 second
Memory limit 64 MiB
Input example #1
45 56
Output example #1
0.803(571428)