class monome:

    def __init__(self,coef,deg):

        self.coef = coef 

        self.deg = deg 



    def affiche(self):

        aff = ''

        if self.deg == 0:

            X = ''

        elif self.deg == 1:

            X = 'X'

        else:

            X = 'X^' + str(self.deg)



        if self.coef < 0:

            aff = str(self.coef) + X

        elif self.coef > 0 and self.coef != 1:

            aff = '+' + str(self.coef) + X 

        elif self.coef == 1:

            aff = '+' + X 

        

        return aff



    def __add__(self , other):

        if self.deg != other.deg: return False

        else: return monome(self.coef + other.coef , self.deg)



    def __sub__(self , other):

        if self.deg != other.deg: return False

        else: return monome(self.coef - other.coef , self.deg)



    def __mul__(self , other):

        return monome(self.coef * other.coef , self.deg + other.deg)