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

public class equation_rs implements Runnable {
	private BufferedReader in;
	private PrintWriter out;
	
	private long gcd(long a, long b) {
		return BigInteger.valueOf(a).gcd(BigInteger.valueOf(b)).longValue();
	}

	private class Element {
		private long a1, a0, b1, b0;
		
		private Element(long a1, long a0, long b1, long b0) {
			this.a1 = a1;
			this.a0 = a0;
			this.b1 = b1;
			this.b0 = b0;
		}
		
		public Element(long a, long b) {
			a1 = 0;
			a0 = a;
			b1 = 0;
			b0 = b;
		}
		
		public Element(char x) {
			if (x != 'X') {
				throw new AssertionError("Unexpected character: " + x);
			}
			a1 = 1;
			a0 = 0;
			b1 = 0;
			b0 = 1;
		}
		
		public Element add(Element that) {
			long xa1 = (a1 * that.b0 + a0 * that.b1) + (b1 * that.a0 + b0 * that.a1); 
			long xa0 = a0 * that.b0 + b0 * that.a0;
			long xb1 = b1 * that.b0 + b0 * that.b1;
			long xb0 = b0 * that.b0;
			return new Element(xa1, xa0, xb1, xb0);
		}
		
		public Element sub(Element that) {
			long xa1 = (a1 * that.b0 + a0 * that.b1) - (b1 * that.a0 + b0 * that.a1); 
			long xa0 = a0 * that.b0 - b0 * that.a0;
			long xb1 = b1 * that.b0 + b0 * that.b1;
			long xb0 = b0 * that.b0;
			return new Element(xa1, xa0, xb1, xb0);
		}
		
		public Element mul(Element that) {
			long xa1 = a1 * that.a0 + a0 * that.a1;
			long xa0 = a0 * that.a0;
			long xb1 = b1 * that.b0 + b0 * that.b1;
			long xb0 = b0 * that.b0;
			return new Element(xa1, xa0, xb1, xb0);
		}
		
		public Element div(Element that) {
			long xa1 = a1 * that.b0 + a0 * that.b1;
			long xa0 = a0 * that.b0;
			long xb1 = b1 * that.a0 + b0 * that.a1;
			long xb0 = b0 * that.a0;
			
			if (xb0 == 0 && xb1 == 0) {
				return null;
			} else {
				return new Element(xa1, xa0, xb1, xb0);
			}
		}

		public long[] solve() {
			if (a1 == 0 && a0 == 0) {
				return new long[] { 0, 0 };
			}
			if (a1 == 0 && a0 != 0) {
				return new long[] { 1, 0 };
			}
			return new long[] { -a0, a1 };
		}
	}
	
	private Element evaluate(char[] commands, long xa, long xb) {
		Element[] stack = new Element[commands.length];
		int sp = 0;
		for (int i = 0; i < commands.length; i++) {
			if (('0' <= commands[i]) && (commands[i] <= '9')) {
				stack[sp++] = new Element(commands[i] - '0', 1);
				continue;
			}
			if (commands[i] == 'X') {
				stack[sp++] = ((xa == 0) && (xb == 0)) ? new Element('X') : new Element(xa, xb);
				continue;
			}
			Element op1 = stack[sp - 2];
			Element op2 = stack[sp - 1];
			Element result = null;
			sp -= 2;
			switch (commands[i]) {
			case '+':
				result = op1.add(op2);
				break;
			case '-':
				result = op1.sub(op2);
				break;
			case '*':
				result = op1.mul(op2);
				break;
			case '/':
				result = op1.div(op2);
				break;
			default:
				throw new AssertionError("Unexpected token: " + commands[i]);
			}
			if (result == null) {
				return null;
			}
			stack[sp++] = result;
		}
		if (sp != 1) {
			throw new AssertionError("Invalid sequence of commands: stack size != 1");
		}
		
		return stack[0];
	}
	
	private void solve() throws IOException {
		StringTokenizer st = new StringTokenizer(in.readLine());
		ArrayList<Character> commands = new ArrayList<Character>();
		while (st.hasMoreTokens()) {
			String cur = st.nextToken();
			if (cur.length() != 1) {
				throw new AssertionError("Unexpected token: " + cur);
			}
			commands.add(cur.charAt(0));
		}
		char[] cmds = new char[commands.size()];
		for (int i = 0; i < commands.size(); i++) {
			cmds[i] = commands.get(i);
		}
		Element result = evaluate(cmds, 0, 0);
		long[] x = result.solve();
		if (x[0] == 0 && x[1] == 0) {
			out.println("MULTIPLE");
			return;
		}
		if (x[0] == 1 && x[1] == 0) {
			out.println("NONE");
			return;
		}
		long g = gcd(x[0], x[1]);
		x[0] = x[0] / g;
		x[1] = x[1] / g;
		if (x[1] < 0) {
			x[0] = -x[0];
			x[1] = -x[1];
		}
		if (evaluate(cmds, x[0], x[1]) == null) {
			out.println("NONE");
		} else {
			out.println("X = " + x[0] + "/" + x[1]);
		}
	}
	
	public static void main(String[] args) {
		new Thread(new equation_rs()).start();
	}

	public void run() {
		String problem = getClass().getName().split("_")[0];
		try {
			in = new BufferedReader(new FileReader(new File(problem + ".in")));
			out = new PrintWriter(new File(problem + ".out"));
			solve();
			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
