import java.io.*;
import java.util.*;

public class Calculator {

    public static void inputLoop () throws IOException {
	String s;
	BufferedReader stdin =
	    new BufferedReader (new InputStreamReader (System.in));

	while (true) {
	    System.out.print ("=>");
	    String postfix = stdin.readLine();
	    if (postfix == null) break;
	    
	    Checker checker = new Checker ();
	    checker.checkLine (postfix);
	    checker.endOfInput ();

	    Evaluator e = new Evaluator (postfix);
	    Tree tree = e.evaluate ();
	    Token.clearAccumulator ();
	    Tree.inorder (tree);
	    String infix = Token.getAccumulator ();
	    System.out.println (infix);
	}
    }
    
    public static void main (String[] args) throws IOException {
	inputLoop ();
    }
}

