#include <string>
#include <iostream>
#include <sstream>
#include <stdexcept>

int gcd(int a, int b)
{
    a = std::abs(a);
    b = std::abs(b);

    while (a)
    {
        int temp = a;
        a = b % a;
        b = temp;
    }

    return b;
}

struct Rational
{
    Rational(std::string);
    friend std::ostream& operator<<(std::ostream&, const Rational&);

private:
    void reduce();

    std::string equation;
    int numerator;
    int denominator;
};

void Rational::reduce()
{
    int divisor = gcd(numerator, denominator);
    numerator /= divisor;
    denominator /= divisor;
}

Rational::Rational(std::string inputString) : equation(inputString)
{
    std::istringstream in(inputString);

    char dummy;
    if (!(in >> numerator) || !(in >> dummy) || !(in >> denominator))
        throw std::invalid_argument("ERROR: Invalid argument - \"" + inputString + '"');

    if (denominator == 0)
        throw std::domain_error("ERROR: Denominator cannot be 0 - \"" + inputString + '"');

    reduce();
}

std::ostream& operator<<(std::ostream& os, const Rational& r)
{
    os << r.numerator;

    if (r.denominator != 1)
        os << " / " << r.denominator;

    return os;
}

int main()
{
    std::string line;
    while (std::getline(std::cin, line) && line.size())
    {
        try {
            std::cout << Rational(line) << '\n';
        }

        catch (std::exception& ex)
        {
            std::cout << ex.what() << '\n';
        }

        std::cout << '\n';
    }
}