eolymp
bolt
Try our new interface for solving problems
Problems

Java Reduce a fraction

Java Reduce a fraction

Time limit 1 second
Memory limit 128 MiB

Reduce a fraction to the lowest terms.

Implement a class Fraction that uses a wrapper class MyLong.

class MyLong // Java
{`
  private long a; // one private variable
  MyLong(long a) // Constructor
  public String toString() // Print a variable of type MyLong
  public MyLong Abs() // return the absolute value of variable of type MyLong
  public long GetValue() // return the value of private variable of type long
  private static long gcd(long a, long b) // find the GCD of two variables of type long
  public static MyLong gcd(MyLong a, MyLong b) // find the GCD of two variables of type MyLong
  public MyLong Divide(MyLong a) // divide two numbers
};

class Fraction
{
  MyLong numerator, denominator; // numerator and denominator
  Fraction() // Constructor
  Fraction (MyLong numerator, MyLong denominator) // Constructor
  public String toString() // Print a variable of type Fraction
  public Fraction Reduce() // Reduce a Fraction
};

Input data

Two integers a and b (-10^18a, b10^18).

Output data

Print the reduced fraction in the form a / b.

Examples

Input example #1
4 8
Output example #1
1/2