import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
  
public class Main {
	private MyIntStack st = new MyIntStack();

    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    }

    private int calc(String[] exp) {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    }

}

class MyIntStack {
	private static final int CAPACITY = 100;
	private int[] stack = new int[CAPACITY];
    private int head = 0;
    
    public boolean isEmpty(){return head == 0;}
    public boolean isFull(){return head == CAPACITY;}
    
    public int pop() {
    	if(isEmpty()) throw new IllegalStateException();
    	return stack[--head];
    }
   
    public int push(int value) {
    	if(isFull()) throw new IllegalStateException();
    	return stack[head++] = value;
    }
}

class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public String[] readStrArray(String delim) throws NumberFormatException, IOException{
    	return br.readLine().split(delim);
    }
    
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {
	private MyIntStack st = new MyIntStack();

    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    }

    private int calc(String[] exp) {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    }

} Main private MyIntStack st = new MyIntStack(); st new MyIntStack() public static void main(String[] args) throws IOException {
        new Main().exec();
    } main {
        new Main().exec();
    } new Main().exec() new Main().exec new Main() String[] args args public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    } exec {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    } SimpleInputUtil in = new SimpleInputUtil(); in new SimpleInputUtil() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.println(calc(in.readStrArray(" "))) out.println out calc(in.readStrArray(" ")) calc in.readStrArray(" ") in.readStrArray in " " out.flush() out.flush out private int calc(String[] exp) {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    } calc {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    } int ret=0; ret 0 for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	} String s exp {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	} {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	} switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		} s.charAt(0) s.charAt s 0 case '+': '+' case '+': {
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		} int b = st.pop(); b st.pop() st.pop st int a = st.pop(); a st.pop() st.pop st ret = st.push(a + b) ret st.push(a + b) st.push st a + b a b break; case '-': '-' case '-': {
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		} int b = st.pop(); b st.pop() st.pop st int a = st.pop(); a st.pop() st.pop st ret = st.push(a - b) ret st.push(a - b) st.push st a - b a b break; case '*': '*' case '*': {
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		} int b = st.pop(); b st.pop() st.pop st int a = st.pop(); a st.pop() st.pop st ret = st.push(a * b) ret st.push(a * b) st.push st a * b a b break; default: default: {
	    			st.push(Integer.parseInt(s));
	    		} st.push(Integer.parseInt(s)) st.push st Integer.parseInt(s) Integer.parseInt Integer s return ret; ret String[] exp exp class MyIntStack {
	private static final int CAPACITY = 100;
	private int[] stack = new int[CAPACITY];
    private int head = 0;
    
    public boolean isEmpty(){return head == 0;}
    public boolean isFull(){return head == CAPACITY;}
    
    public int pop() {
    	if(isEmpty()) throw new IllegalStateException();
    	return stack[--head];
    }
   
    public int push(int value) {
    	if(isFull()) throw new IllegalStateException();
    	return stack[head++] = value;
    }
} MyIntStack private static final int CAPACITY = 100; CAPACITY 100 private int[] stack = new int[CAPACITY]; stack new int[CAPACITY] CAPACITY private int head = 0; head 0 public boolean isEmpty(){return head == 0;} isEmpty {return head == 0;} return head == 0; head == 0 head 0 public boolean isFull(){return head == CAPACITY;} isFull {return head == CAPACITY;} return head == CAPACITY; head == CAPACITY head CAPACITY public int pop() {
    	if(isEmpty()) throw new IllegalStateException();
    	return stack[--head];
    } pop {
    	if(isEmpty()) throw new IllegalStateException();
    	return stack[--head];
    } if(isEmpty()) throw new IllegalStateException(); isEmpty() isEmpty throw new IllegalStateException(); new IllegalStateException() return stack[--head]; stack[--head] stack --head head public int push(int value) {
    	if(isFull()) throw new IllegalStateException();
    	return stack[head++] = value;
    } push {
    	if(isFull()) throw new IllegalStateException();
    	return stack[head++] = value;
    } if(isFull()) throw new IllegalStateException(); isFull() isFull throw new IllegalStateException(); new IllegalStateException() return stack[head++] = value; stack[head++] = value stack[head++] stack head++ head value int value value class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public String[] readStrArray(String delim) throws NumberFormatException, IOException{
    	return br.readLine().split(delim);
    }
    
} SimpleInputUtil BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) public String[] readStrArray(String delim) throws NumberFormatException, IOException{
    	return br.readLine().split(delim);
    } readStrArray {
    	return br.readLine().split(delim);
    } return br.readLine().split(delim); br.readLine().split(delim) br.readLine().split br.readLine() br.readLine br delim String delim delim public class Main {
	private MyIntStack st = new MyIntStack();

    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    }

    private int calc(String[] exp) {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    }

} public class Main {
	private MyIntStack st = new MyIntStack();

    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    }

    private int calc(String[] exp) {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
  
public class Main {
	private MyIntStack st = new MyIntStack();

    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        out.println(calc(in.readStrArray(" ")));
        out.flush();
    }

    private int calc(String[] exp) {
    	int ret=0;
    	for(String s: exp) {
    		switch(s.charAt(0)){
	    		case '+':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a + b);
	    			break;
	    		}
	    		case '-':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a - b);
	    			break;
	    		}
	    		case '*':{
	    			int b = st.pop();
	    			int a = st.pop();
	    			ret = st.push(a * b);
	    			break;
	    		}
	    		default:{
	    			st.push(Integer.parseInt(s));
	    		}
    		}
    	}
    	return ret;
    }

}

class MyIntStack {
	private static final int CAPACITY = 100;
	private int[] stack = new int[CAPACITY];
    private int head = 0;
    
    public boolean isEmpty(){return head == 0;}
    public boolean isFull(){return head == CAPACITY;}
    
    public int pop() {
    	if(isEmpty()) throw new IllegalStateException();
    	return stack[--head];
    }
   
    public int push(int value) {
    	if(isFull()) throw new IllegalStateException();
    	return stack[head++] = value;
    }
}

class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public String[] readStrArray(String delim) throws NumberFormatException, IOException{
    	return br.readLine().split(delim);
    }
    
}