import java.util.Scanner;

/* E->(E+E)
 * E-> int
 */

public class Calc1 {
    
    private static Scanner s;        // tokenizer
    private static int result;       // value of parsed expression
    private static String copy="";   // copy of parsed String
    private static String original;  // original expression

    public static void main(String[] args) {
	setTokenizer(args);
	parseExp();
	showResult();
	s.close();
    }
    
    private static void setTokenizer(String[] args) {
	try {
	    if(args.length < 1) {
		System.out.println("Usage: Calc1 \"expression to parse\"");
		System.exit(0);
	    }
	    original=args[0];
	    s = new Scanner(args[0]);
	} 
	catch(Exception e) {
	    System.out.println("Error:" + e.getMessage());
	    System.exit(0);
	}
    }

    private static void parseExp() {

	String token=s.next();
	copy+=token;

	if (token.equals("(")) { // (
	    parseExp();          // E
	    copy+=s.next();      // +
	    parseExp();          // E
	    copy+=s.next();      // )
	}
	else                     // int
	    result+=Integer.parseInt(token);
    }

    private static void showResult() {
	System.out.println("Original expression:  " + original);
	System.out.println("Copy of expression:   " + copy);
	System.out.println("Result of expression: " + result);
    }

    
}
