module Main
	where

import System.IO

split :: [String] -> [[Int]]
split [] = []
split (c:cs) = (map (read . last . words) a):split b
	where
		(n:_) = map read $ words c
		(a,b) = splitAt n cs

renderReduce :: Int -> Int -> String
renderReduce a b = show (a `div` t) ++ " / " ++ show (b `div` t)
	where t = gcd a b

solve :: [Int] -> [String]
solve ns = map (flip renderReduce $ sum ns) ns

main :: IO ()
main = openFile "another.in" ReadMode >>= hGetContents >>= mapM_ putStrLn . concat . map solve . split . init . lines
