import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    }
    static boolean isOperator (String a) {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    }
    static boolean isOperator (String a) {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    }
} Main public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    } main {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] inputs = scan.nextLine().split(" "); inputs scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " int[] operands = new int[100]; operands new int[100] 100 int cursol = 0; cursol 0 for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	} int i = 0; int i = 0; i 0 i < inputs.length i inputs.length inputs inputs.length i++ i++ i {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	} {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	} int n = -1; n -1 1 if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    } isOperator(inputs[i]) isOperator inputs[i] inputs i {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    } int op1 = operands[cursol - 2]; op1 operands[cursol - 2] operands cursol - 2 cursol 2 int op2 = operands[cursol - 1]; op2 operands[cursol - 1] operands cursol - 1 cursol 1 if (inputs[i].equals("+")) {
		    n = op1 + op2;
		} inputs[i].equals("+") inputs[i].equals inputs[i] inputs i "+" {
		    n = op1 + op2;
		} n = op1 + op2 n op1 + op2 op1 op2 if (inputs[i].equals("-")) {
		    n = op1 - op2;
		} inputs[i].equals("-") inputs[i].equals inputs[i] inputs i "-" {
		    n = op1 - op2;
		} n = op1 - op2 n op1 - op2 op1 op2 if (inputs[i].equals("*")) {
		    n = op1 * op2;
		} inputs[i].equals("*") inputs[i].equals inputs[i] inputs i "*" {
		    n = op1 * op2;
		} n = op1 * op2 n op1 * op2 op1 op2 cursol -= 2 cursol 2 {
		n = Integer.parseInt(inputs[i]);
	    } n = Integer.parseInt(inputs[i]) n Integer.parseInt(inputs[i]) Integer.parseInt Integer inputs[i] inputs i operands[cursol++] = n operands[cursol++] operands cursol++ cursol n System.out.println(operands[0]) System.out.println System.out System System.out operands[0] operands 0 String[] args args static boolean isOperator (String a) {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    } isOperator {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    } if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	} a.equals("+") || a.equals("-") || a.equals("*") a.equals("+") || a.equals("-") || a.equals("*") a.equals("+") a.equals a "+" a.equals("-") a.equals a "-" a.equals("*") a.equals a "*" {
	    return true;
	} return true; true return false; false String a a public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    }
    static boolean isOperator (String a) {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    }
} public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    }
    static boolean isOperator (String a) {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String[] inputs = scan.nextLine().split(" ");
	int[] operands = new int[100];
	int cursol = 0;
	for (int i = 0; i < inputs.length; i++) {
	    int n = -1;
	    if (isOperator(inputs[i])) {
		int op1 = operands[cursol - 2];
		int op2 = operands[cursol - 1];
		if (inputs[i].equals("+")) {
		    n = op1 + op2;
		}
		if (inputs[i].equals("-")) {
		    n = op1 - op2;
		}
		if (inputs[i].equals("*")) {
		    n = op1 * op2;
		}
		cursol -= 2;
	    }
	    else {
		n = Integer.parseInt(inputs[i]);
	    }
	    operands[cursol++] = n;
	}
	System.out.println(operands[0]);
    }
    static boolean isOperator (String a) {
	if (a.equals("+") || a.equals("-") || a.equals("*")) {
	    return true;
	}
	return false;
    }
}