def pgcd(a,b) :
    """Retourne le pgcd du signe de b"""
    (A,B)=(a,b)
    while B != 0:
        (A,B)=(B,A%B)
    return(A)

class Fraction :
    "Attributs : Num, Den"
    
    def __init__(self, a, b) :
        if b == 0:
            raise ZeroDivisionError
        d = pgcd(a,b)
        self.Num = a//d
        self.Den = b//d 
    
    def __repr__(self):
        a = self.Num
        b = self.Den
        if b == 1:
            return(str(a))
        return(str(a)+"/"+str(b))
    
    def __eq__(self,other):
        a = self.Num
        b = self.Den
        if type(other)==int:
            other=Fraction(other,1)
        c = other.Num
        d = other.Den
        return(a*d == b*c)
    
    def __add__(self,other):
        if type(other)==int:
            other=Fraction(other,1)
        a = self.Num
        b = self.Den
        c = other.Num
        d = other.Den
        return(Fraction(a*d+b*c,b*d))
    
    def __sub__(self,other):
        if type(other)==int:
            other=Fraction(other,1)
        return(self+Fraction(-other.Num,other.Den))
    
    def __mul__(self,other):
        if type(other)==int:
            other=Fraction(other,1)
        a = self.Num
        b = self.Den
        c = other.Num
        d = other.Den
        return(Fraction(a*c,b*d))