(*--------------------------------------------------------------*)
(* ACM ICPC 2007-2008                                           *)
(* Northeastern European Regional Contest                       *)
(* St Petersburg - Barnaul - Tashkent - Batumi, November 28, 200*)
(*--------------------------------------------------------------*)
(* Problem E. Equation                                          *)
(*--------------------------------------------------------------*)
(* Solution                                                     *)
(*                                                              *)
(* Author                Petr Mitrichev                         *)
(*--------------------------------------------------------------*)
 
{$APPTYPE CONSOLE}
{$R+,Q+,S+,I+,H+,O-}

uses
  Math, SysUtils;

Const
  TaskID='equation';
  InFile=TaskID+'.in';
  OutFile=TaskID+'.out';
  MaxStack=50;
  MaxBad=50;

Type
  Item=Record
    A,B,C,D:Int64;
  End;
  Fraction=Record
    P,Q:Int64;
  End;

Var
  NS:Integer;
  S:Array[1..MaxStack]Of Item;
  NB:Integer;
  B:Array[1..MaxBad]Of Fraction;
  Res:String;

Function GCD(P,Q:Int64):Int64;
Var
  A,B,T:Int64;
Begin
  A:=Abs(P);
  B:=Abs(Q);
  While B>0 Do Begin
    T:=A Mod B;
    A:=B;
    B:=T;
  End;
  Result:=A;
End;

Procedure Norm(Var Z:Fraction);
Var
  G:Int64;
Begin
  G:=GCD(Z.P,Z.Q);
  If Z.Q<0 Then G:=-G;
  Z.P:=Z.P Div G;
  Z.Q:=Z.Q Div G;
End;

Function Next:String;
Var
  Ch:Char;
Begin
  Repeat
    Read(Ch);
  Until Ch>' ';
  Result:='';
  Repeat
    Result:=Result+Ch;
    Read(Ch);
  Until Ch<=' ';
End;

Procedure Load;
Begin
End;

Function Resolve(Z:Item; Var F:Fraction):Integer;
Begin
  If (Z.A=0) And (Z.B=0) Then Result:=2 Else
  If Z.A=0 Then Result:=0 Else Begin
    Result:=1;
    F.P:=-Z.B;
    F.Q:=Z.A;
    Norm(F);
  End;
End;

Procedure Solve;
Var
  St:String;
  I1,I2:Item;
  I,Sg:Integer;
  Fr:Fraction;
Begin
  NS:=0;
  NB:=0;
  While Not SeekEOF Do Begin
    St:=Next;
    Case St[1] Of
      'X':Begin
        Inc(NS);
        S[NS].A:=1;
        S[NS].B:=0;
        S[NS].C:=0;
        S[NS].D:=1;
      End;
      '0'..'9':Begin
        Inc(NS);
        S[NS].A:=0;
        S[NS].B:=StrToInt(St);
        S[NS].C:=0;
        S[NS].D:=1;
      End;
      '+','-':Begin
        I2:=S[NS];
        Dec(NS);
        I1:=S[NS];
        Sg:=1;
        If St[1]='-' Then Sg:=-1;
        S[NS].A:=I1.A*I2.D+I1.B*I2.C+Sg*(I2.A*I1.D+I2.B*I1.C);
        S[NS].B:=I1.B*I2.D+Sg*I2.B*I1.D;
        S[NS].C:=I1.C*I2.D+I2.C*I1.D;
        S[NS].D:=I1.D*I2.D;
      End;
      '*':Begin
        I2:=S[NS];
        Dec(NS);
        I1:=S[NS];
        S[NS].A:=I1.A*I2.B+I2.A*I1.B;
        S[NS].B:=I1.B*I2.B;
        S[NS].C:=I1.C*I2.D+I2.C*I1.D;
        S[NS].D:=I1.D*I2.D;
      End;
      '/':Begin
        If Resolve(S[NS],Fr)=1 Then Begin
          Inc(NB);
          B[NB]:=Fr;
        End;
        I2:=S[NS];
        Dec(NS);
        I1:=S[NS];
        S[NS].A:=I1.A*I2.D+I2.C*I1.B;
        S[NS].B:=I1.B*I2.D;
        S[NS].C:=I1.C*I2.B+I2.A*I1.D;
        S[NS].D:=I1.D*I2.B;
      End;
    End;
  End;
  Assert(NS=1);
  Sg:=Resolve(S[1],Fr);
  If (Sg=1) Then Begin
    For I:=1 To NB Do If (B[I].P=Fr.P) And (B[I].Q=Fr.Q) Then Sg:=0;
  End;
  Case Sg Of
    0:Res:='NONE';
    2:Res:='MULTIPLE';
    1:Res:='X = '+ IntToStr(Fr.P)+'/'+IntToStr(Fr.Q);
  End;
End;

Procedure Save;
Begin
  WriteLn(Res);
  Close(Input);
End;

begin
  Load;
  Solve;
  Save;
end.
 