Skip to main content
LIVE CONTEST: ALGOR Contest: Round #4 (Special Challenge) is live now!

~/algor $ cat problems/funksiya-kasrni-qisqartirish

Reducing a fraction

Easy 1000 ms 128 MB 33%
Share

Write a function Reduce(p, q) that reduces the fraction $\frac{p}{q}$ and returns the result as a string "numerator/denominator". To reduce a fraction, the numerator and the denominator are divided by their greatest common divisor.

Example 1: Reduce(6, 8) → "3/4"

Example 2: Reduce(10, 5) → "2/1" — a whole number is written as a fraction too.

Write only the function body.

The numerator and the denominator are divided by a common divisor, the reduced fraction is returned

Input

One line with two positive integers $p$ and $q$ — the arguments of the function.

Output

The string returned by the function: the reduced fraction, e.g. 3/4.

Note

$1 \le p, q \le 10^{15}$

Examples

Input #1
6 8
Output #1
3/4
Input #2
10 5
Output #2
2/1

Sign in to submit a solution

Signing up is free and takes a minute.