/*--------------------------------------------------------------*/
/* ACM ICPC 2007-2008                                           */
/* Northeastern European Regional Contest                       */
/* St Petersburg - Barnaul - Tashkent - Batumi, November 28, 200*/
/*--------------------------------------------------------------*/
/* Problem E. Equation                                          */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Georgiy Korneev                        */
/*--------------------------------------------------------------*/
 
import java.io.*;
import java.util.*;

public class equation_gk_trace {
    static Scanner in;
    static PrintWriter out;
    static int[] t = new int[22];

    Fraction ZERO = new Fraction("0");

    class Fraction {
        final long n;
        final long d;

        Fraction(String s) {            
            this(new Long(s), 1);
        }

        Fraction(long n, long d) {
            long g = gcd(n, d);
            if (d < 0) {
                t[0]++;
                g = -g;
            }
            this.n = n / g;
            this.d = d / g;
        }

        long gcd(long a, long b) {            
            if (a == 0) {
                return Math.abs(b);
            }
            return gcd(b % a, a);
        }

        Fraction add(Fraction that) {
            t[1]++;
            return new Fraction(this.n * that.d + that.n * this.d, this.d * that.d);
        }

        Fraction sub(Fraction that) {
            t[2]++;
            return new Fraction(this.n * that.d - that.n * this.d, this.d * that.d);
        }

        Fraction mul(Fraction that) {
            t[3]++;
            return new Fraction(this.n * that.n, this.d * that.d);
        }

        Fraction div(Fraction that) {
            assert(that.n != 0);
            t[4]++;
            return new Fraction(this.n * that.d, this.d * that.n);
        }

        @Override
        public boolean equals(Object that) {
            return this.toString().equals(that.toString());
        }

        @Override
        public String toString() {
            return n + "/" + d;
        }
    }

    class Node {
        final char op;
        final Node op1;
        final Node op2;
        Fraction value;

        Node(char op, Node op1, Node op2) {
            this.op = op;
            this.op1 = op1;
            this.op2 = op2;
        }

        Node(Fraction value) {
            this('v', null, null);
            this.value = value;
        }

        void btop() {
            Fraction v1 = op1.value;
            Fraction v2 = op2.value;
            switch (op) {
                case '+':
                    if (v1 != null && v2 != null) {
                        t[5]++;
                        value = v1.add(v2);
                    } else {
                        t[6]++;
                    }
                    break;
                case '-':
                    if (v1 != null && v2 != null) {
                        t[7]++;
                        value = v1.sub(v2);
                    } else {
                        t[8]++;
                    }
                    break;
                case '*':
                    if (v1 != null && v2 != null) {
                        t[9]++;
                        value = v1.mul(v2);
                    } else if (v1 != null && v1.equals(ZERO) || v2 != null && v2.equals(ZERO)) {
                        t[10]++;
                        value = ZERO;
                    } else {
                        t[11]++;
                    }
                    break;
                case '/':
                    if (v1 != null && v2 != null) {
                        t[12]++;
                        assert !ZERO.equals(v2);
                        //System.out.println(v1 + " " + v2 + " " + ZERO);
                        value = v1.div(v2);
                    } else if (v1 != null && v1.equals(ZERO)) {
                        t[13]++;
                        value = ZERO;
                    } else if (v2 != null && v2.equals(ZERO)) {
                        throw new AssertionError("Division by zero");
                    } else {
                        t[14]++;
                    }
                    break;
                default:
                    throw new AssertionError("" + op);
            }
            //System.out.println(v1 + " " + op + " " + v2 + " = " + value);
        }

        void ttob(Fraction top) {
            if (op == 'X') {
                value = top;
                return;
            }
            Fraction v1 = op1.value;
            Fraction v2 = op2.value;
            if (v2 == null) {
                assert v1 != null;
                op2.ttob(ttob1(top, v1));
            } else {
                assert v2 != null;
                op1.ttob(ttob2(top, v2));
            }
        }

        Fraction ttob1(Fraction top, Fraction v1) {
            switch (op) {
                case '+':
                    t[15]++;
                    return top.sub(v1);
                case '-':
                    t[16]++;
                    return v1.sub(top);
                case '*':
                    return top.div(v1);
                case '/':
                    if (ZERO.equals(top)) {
                        throw new ArithmeticException();
                    }
                    t[17]++;
                    return v1.div(top);
                default:
                    throw new AssertionError("ttob1: " + op);
            }
        }

        Fraction ttob2(Fraction top, Fraction v2) {
            switch (op) {
                case '+':
                    t[18]++;
                    return top.sub(v2);
                case '-':
                    t[19]++;
                    return top.add(v2);
                case '*':
                    t[20]++;
                    return top.div(v2);
                case '/':
                    t[21]++;
                    return top.mul(v2);
                default:
                    throw new AssertionError("ttob2: " + op);
            }
        }
    }

    void run() {
        String line = in.nextLine();
        LinkedList<Node> stack = new LinkedList<Node>();
        Node x = null;

        for (char ch : line.toCharArray()) {
            if (ch == ' ') {
                continue;
            }
            //System.err.print(ch);
            final Node node;
            if ('0' <= ch && ch <= '9') {
                node = new Node(new Fraction("" + ch));
            } else if (ch == 'X') {
                node = new Node('X', null, null);
                x = node;
            } else {
                Node op2 = stack.removeLast();
                Node op1 = stack.removeLast();
                node = new Node(ch, op1, op2);
                node.btop();
            }
            stack.add(node);
        }

        Node root = stack.removeLast();
        assert stack.isEmpty();
        if (root.value != null) {
            if (root.value.equals(ZERO)) {
                out.println("MULTIPLE");
            } else {
                out.println("NONE");
            }
        } else {
            try {
                root.ttob(ZERO);
                out.println("X = " + x.value);
            } catch (ArithmeticException e) {
                out.println("NONE");
            }
        }
        /*
        if (t[19] != 0) {
            System.out.println(line);
            //t[19] = 0;
        }
        */
    }

    public static void main(String[] args) throws IOException {
        in = new Scanner(new File("equation.in"));
        out = new PrintWriter("equation.out");

        while (in.hasNext()) {
            try {
            new equation_gk_trace().run();
            } catch (AssertionError e) {
            }
        }

        int min = t[0];
        for (int i = 0; i < t.length; i++) {
            min = Math.min(min, t[i]);
            System.out.format("t[%d]=%d ", i, t[i]);
        }
        System.out.format("\nmin = %d\n", min);

        out.close();
        in.close();
    }
}
