Gcd and lcm
题号:NC213482
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 64 M,其他语言128 M
64bit IO Format: %lld

题目描述

English ability is the most significant subject for the Computer Science and Technology Department in all of the STEM(Science, technology, engineering, and mathematics). Kcxz heard of some new ACMer don't understand the English problems, so he put forward the unique English problem in this competition. "" stands for "greatest common divisor", and "" stands for "least common multiple".

.
In these two formulas, you must guarantee that all of the fractions are irreducible fractions, which means . Now kcxz believes you have got it, so please solve this question!

输入描述:

The input consists of several test cases and is terminated by the end-of-file. For each test case, there are one character and two fractions. If the character is '', answer the gcd of the two fractions. If the character is '', answer the lcm of the two fractions. It is guaranteed that the sum of the test cases could not exceed .

输出描述:

For each test case, print a fraction in one line representing the answer. If the fraction's denominator is equal to one, output the numerator only. Otherwise, print a fraction like  where  and  are relatively prime.
示例1

输入

复制
L 10/4 7/2
G 12/3 6/2
L 3/4 5/8

输出

复制
35/2
1
15/4