P28291 [洛谷] non Hates Math
提高-
题目描述

Problem Background

non is accustomed to converting fractions into decimals, but in mathematics, fractions must be written in fractional form and cannot be converted into decimals.

Therefore, non has sought out a programmer like you to help him convert decimals back into fractions.

Problem Description

Given a decimal, convert it into an improper fraction form.

There are two types of decimals (excluding infinite non-repeating decimals):

  • Regular decimal
  • Repeating decimal (the repeating part will be provided)

(The repeating part is indicated by parentheses ( ))

Input Format

A decimal number n.

Output Format

Output the decimal number n converted into its simplest fractional form.

Sample Input and Output

Sample Input #1

1.32

Sample Output #1

33/25

Sample Input #2

1.(3)

Sample Output #2

4/3

Sample Input #3

1.0

Sample Output #3

1/1

Notes

The range of the input decimal number:

  • From 0 to 1000

For 50% of the test cases, there will be no repeating part.

For 20% of the test cases, input optimization is required.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1.32
样例输出
33/25