import java.util.Scanner;

class Main {

    static intStack stack;
    static Scanner scan;
    
    public static void main(String[] args) {
	// get from Std in
	scan  = new Scanner(System.in);
        String input = scan.nextLine();

	// scan: input string
	scan = new Scanner(input);

	// create: stack
	intStack s = new intStack(100);

	// start: calc.
	String c; // token
	int a, b; // number: use in calc
	for(int i = 0; scan.hasNext(); i += 2) {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	}
	System.out.println(s.pop());
	
    }
}

class intStack {
    private static int length;
    private static int[] Stack;
    private static int current;

    public intStack(int length) {
	this.length = length;
	this.Stack = new int[length];
	this.current = 0;
    }

    public void push(int data) {
	this.Stack[current] = data;
	current++;
    }

    public int pop() {
	if (current == 0) return 0;
	current--;
	return this.Stack[current];
    }
}
 import java.util.Scanner; Scanner java.util class Main {

    static intStack stack;
    static Scanner scan;
    
    public static void main(String[] args) {
	// get from Std in
	scan  = new Scanner(System.in);
        String input = scan.nextLine();

	// scan: input string
	scan = new Scanner(input);

	// create: stack
	intStack s = new intStack(100);

	// start: calc.
	String c; // token
	int a, b; // number: use in calc
	for(int i = 0; scan.hasNext(); i += 2) {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	}
	System.out.println(s.pop());
	
    }
} Main static intStack stack; stack static Scanner scan; scan public static void main(String[] args) {
	// get from Std in
	scan  = new Scanner(System.in);
        String input = scan.nextLine();

	// scan: input string
	scan = new Scanner(input);

	// create: stack
	intStack s = new intStack(100);

	// start: calc.
	String c; // token
	int a, b; // number: use in calc
	for(int i = 0; scan.hasNext(); i += 2) {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	}
	System.out.println(s.pop());
	
    } main {
	// get from Std in
	scan  = new Scanner(System.in);
        String input = scan.nextLine();

	// scan: input string
	scan = new Scanner(input);

	// create: stack
	intStack s = new intStack(100);

	// start: calc.
	String c; // token
	int a, b; // number: use in calc
	for(int i = 0; scan.hasNext(); i += 2) {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	}
	System.out.println(s.pop());
	
    } scan  = new Scanner(System.in) scan new Scanner(System.in) String input = scan.nextLine(); input scan.nextLine() scan.nextLine scan scan = new Scanner(input) scan new Scanner(input) intStack s = new intStack(100); s new intStack(100) String c; c int a a b; b for(int i = 0; scan.hasNext(); i += 2) {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	} int i = 0; int i = 0; i 0 scan.hasNext() scan.hasNext scan i += 2 i += 2 i 2 {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	} {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	} c = scan.next() c scan.next() scan.next scan switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    } c case "+": "+" case "+": a = s.pop() a s.pop() s.pop s b = s.pop() b s.pop() s.pop s s.push(b + a) s.push s b + a b a break; case "-": "-" case "-": a = s.pop() a s.pop() s.pop s b = s.pop() b s.pop() s.pop s s.push(b - a) s.push s b - a b a break; case "*": "*" case "*": a = s.pop() a s.pop() s.pop s b = s.pop() b s.pop() s.pop s s.push(b * a) s.push s b * a b a break; default: default: int n = Integer.parseInt(c); n Integer.parseInt(c) Integer.parseInt Integer c s.push(n) s.push s n System.out.println(s.pop()) System.out.println System.out System System.out s.pop() s.pop s String[] args args class intStack {
    private static int length;
    private static int[] Stack;
    private static int current;

    public intStack(int length) {
	this.length = length;
	this.Stack = new int[length];
	this.current = 0;
    }

    public void push(int data) {
	this.Stack[current] = data;
	current++;
    }

    public int pop() {
	if (current == 0) return 0;
	current--;
	return this.Stack[current];
    }
} intStack private static int length; length private static int[] Stack; Stack private static int current; current public intStack(int length) {
	this.length = length;
	this.Stack = new int[length];
	this.current = 0;
    } intStack {
	this.length = length;
	this.Stack = new int[length];
	this.current = 0;
    } this.length = length this.length this this.length length this.Stack = new int[length] this.Stack this this.Stack new int[length] length this.current = 0 this.current this this.current 0 int length length public void push(int data) {
	this.Stack[current] = data;
	current++;
    } push {
	this.Stack[current] = data;
	current++;
    } this.Stack[current] = data this.Stack[current] this.Stack this this.Stack current data current++ current int data data public int pop() {
	if (current == 0) return 0;
	current--;
	return this.Stack[current];
    } pop {
	if (current == 0) return 0;
	current--;
	return this.Stack[current];
    } if (current == 0) return 0; current == 0 current 0 return 0; 0 current-- current return this.Stack[current]; this.Stack[current] this.Stack this this.Stack current
import java.util.Scanner;

class Main {

    static intStack stack;
    static Scanner scan;
    
    public static void main(String[] args) {
	// get from Std in
	scan  = new Scanner(System.in);
        String input = scan.nextLine();

	// scan: input string
	scan = new Scanner(input);

	// create: stack
	intStack s = new intStack(100);

	// start: calc.
	String c; // token
	int a, b; // number: use in calc
	for(int i = 0; scan.hasNext(); i += 2) {
	    c = scan.next();
	    switch (c) {
	    case "+":
		a = s.pop();
		b = s.pop();
	        s.push(b + a);
		break;
	    case "-":
		a = s.pop();
		b = s.pop();
		s.push(b - a);
		break;
	    case "*":
		a = s.pop();
		b = s.pop();
		s.push(b * a);
		break;
	    default:
		int n = Integer.parseInt(c);
		s.push(n);
	    }
	}
	System.out.println(s.pop());
	
    }
}

class intStack {
    private static int length;
    private static int[] Stack;
    private static int current;

    public intStack(int length) {
	this.length = length;
	this.Stack = new int[length];
	this.current = 0;
    }

    public void push(int data) {
	this.Stack[current] = data;
	current++;
    }

    public int pop() {
	if (current == 0) return 0;
	current--;
	return this.Stack[current];
    }
}

