str = gets.chomp.delete(')').split('(')
if str.length == 1
    i = str[0].index('.')
    if i.nil?
        puts str[0] + "/1"
    else
        puts Rational(str[0].delete('.').to_i, 10 ** (str[0].length - 1 - i))
    end
else
    bunbo1 = 10 ** (str[0].length - 1 - str[0].index('.'))
    bunbo2 = 10 ** (str[1].length) * bunbo1
    bunshi1 = str[0].delete('.')
    bunshi2 = (bunshi1 + str[1]).to_i
    puts Rational(bunshi2 - bunshi1.to_i, bunbo2 - bunbo1)
end
