f | from fractions import Fraction | f | from fractions import Fraction |
n | s = input() | n | inpt = input() |
| new_s = '' | | str1 = '' |
| buf = '' | | str2 = '' |
| for i in range(len(s)): | | for i in range(len(inpt)): |
| if '0' <= s[i] <= '9' or s[i] == '.': | | if '0' <= inpt[i] <= '9' or inpt[i] == '.': |
| buf += s[i] | | str2 += inpt[i] |
| elif len(buf) != 0: | | elif len(str2) != 0: |
| new_s += "Fraction('" + buf + "')" + s[i] | | str1 += "Fraction('" + str2 + "')" + inpt[i] |
| buf = '' | | str2 = '' |
| else: | | else: |
t | new_s += s[i] | t | str1 += inpt[i] |
| if i == len(s) - 1 and len(buf) != 0: | | if i == len(inpt) - 1 and len(str2) != 0: |
| new_s += "Fraction('" + buf + "')" | | str1 += "Fraction('" + str2 + "')" |
| print(eval(new_s)) | | print(eval(str1)) |