import GHC.Real import Data.Bool newtype A=A Rational instance Show A where show(A(x:%y))=show x++bool""("/"++show y)(y>1) main=interact$unlines.fmap(show.A.(%2).read).lines