

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main {


   public static void main(String args[]) throws IOException{

	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	 String[] string =  br.readLine().split(" ");
	 String[] formula = new String[ string.length ];


	 Stack stack = new Stack();
     stack.initialize();


     for(int i = 0;i < string.length; i++){


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     }


     System.out.println(stack.pop());
 }
}

class Stack {
	int top = 0;
    int MAX = 200;
    String[] S = new String[200];


	void initialize(){
       top = 0;
    }

    boolean isEmpty(){
    	return top == 0;
    }


    boolean isFull(){
    	return top >= MAX - 1;
    }

    void push(String x ){

    	if(isFull()){System.out.println("??¨??????");}
    	top++;
        S[top] = x;

    }

    String pop(){
    	if(isEmpty()){System.out.println("??¨??????");}
    	top--;
    	return  S[top+1];
    }



} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {


   public static void main(String args[]) throws IOException{

	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	 String[] string =  br.readLine().split(" ");
	 String[] formula = new String[ string.length ];


	 Stack stack = new Stack();
     stack.initialize();


     for(int i = 0;i < string.length; i++){


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     }


     System.out.println(stack.pop());
 }
} Main public static void main(String args[]) throws IOException{

	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	 String[] string =  br.readLine().split(" ");
	 String[] formula = new String[ string.length ];


	 Stack stack = new Stack();
     stack.initialize();


     for(int i = 0;i < string.length; i++){


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     }


     System.out.println(stack.pop());
 } main {

	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	 String[] string =  br.readLine().split(" ");
	 String[] formula = new String[ string.length ];


	 Stack stack = new Stack();
     stack.initialize();


     for(int i = 0;i < string.length; i++){


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     }


     System.out.println(stack.pop());
 } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] string =  br.readLine().split(" "); string br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String[] formula = new String[ string.length ]; formula new String[ string.length ] string.length string string.length Stack stack = new Stack(); stack new Stack() stack.initialize() stack.initialize stack for(int i = 0;i < string.length; i++){


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     } int i = 0; int i = 0; i 0 i < string.length i string.length string string.length i++ i++ i {


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     } {


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     } if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 } string[i].equals("+") string[i].equals string[i] string i "+" {
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 } int x = Integer.parseInt(stack.pop() ); x Integer.parseInt(stack.pop() ) Integer.parseInt Integer stack.pop() stack.pop stack int y = Integer.parseInt(stack.pop() ); y Integer.parseInt(stack.pop() ) Integer.parseInt Integer stack.pop() stack.pop stack int result = x + y; result x + y x y stack.push( String.valueOf(result) ) stack.push stack String.valueOf(result) String.valueOf String result if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 } string[i].equals("-") string[i].equals string[i] string i "-" {
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 } int x = Integer.parseInt(stack.pop() ); x Integer.parseInt(stack.pop() ) Integer.parseInt Integer stack.pop() stack.pop stack int y = Integer.parseInt(stack.pop() ); y Integer.parseInt(stack.pop() ) Integer.parseInt Integer stack.pop() stack.pop stack int result = y - x; result y - x y x stack.push( String.valueOf(result) ) stack.push stack String.valueOf(result) String.valueOf String result if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 } string[i].equals("*") string[i].equals string[i] string i "*" {
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 } int x = Integer.parseInt(stack.pop() ); x Integer.parseInt(stack.pop() ) Integer.parseInt Integer stack.pop() stack.pop stack int y = Integer.parseInt(stack.pop() ); y Integer.parseInt(stack.pop() ) Integer.parseInt Integer stack.pop() stack.pop stack int result = x * y; result x * y x y stack.push( String.valueOf(result) ) stack.push stack String.valueOf(result) String.valueOf String result {
    		 stack.push( string[i] );
    	 } stack.push( string[i] ) stack.push stack string[i] string i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String args[] args class Stack {
	int top = 0;
    int MAX = 200;
    String[] S = new String[200];


	void initialize(){
       top = 0;
    }

    boolean isEmpty(){
    	return top == 0;
    }


    boolean isFull(){
    	return top >= MAX - 1;
    }

    void push(String x ){

    	if(isFull()){System.out.println("??¨??????");}
    	top++;
        S[top] = x;

    }

    String pop(){
    	if(isEmpty()){System.out.println("??¨??????");}
    	top--;
    	return  S[top+1];
    }



} Stack int top = 0; top 0 int MAX = 200; MAX 200 String[] S = new String[200]; S new String[200] 200 void initialize(){
       top = 0;
    } initialize {
       top = 0;
    } top = 0 top 0 boolean isEmpty(){
    	return top == 0;
    } isEmpty {
    	return top == 0;
    } return top == 0; top == 0 top 0 boolean isFull(){
    	return top >= MAX - 1;
    } isFull {
    	return top >= MAX - 1;
    } return top >= MAX - 1; top >= MAX - 1 top MAX - 1 MAX 1 void push(String x ){

    	if(isFull()){System.out.println("??¨??????");}
    	top++;
        S[top] = x;

    } push {

    	if(isFull()){System.out.println("??¨??????");}
    	top++;
        S[top] = x;

    } if(isFull()){System.out.println("??¨??????");} isFull() isFull {System.out.println("??¨??????");} System.out.println("??¨??????") System.out.println System.out System System.out "??¨??????" top++ top S[top] = x S[top] S top x String x x String pop(){
    	if(isEmpty()){System.out.println("??¨??????");}
    	top--;
    	return  S[top+1];
    } pop {
    	if(isEmpty()){System.out.println("??¨??????");}
    	top--;
    	return  S[top+1];
    } if(isEmpty()){System.out.println("??¨??????");} isEmpty() isEmpty {System.out.println("??¨??????");} System.out.println("??¨??????") System.out.println System.out System System.out "??¨??????" top-- top return  S[top+1]; S[top+1] S top+1 top 1


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main {


   public static void main(String args[]) throws IOException{

	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	 String[] string =  br.readLine().split(" ");
	 String[] formula = new String[ string.length ];


	 Stack stack = new Stack();
     stack.initialize();


     for(int i = 0;i < string.length; i++){


    	 if( string[i].equals("+")  ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
             int result = x + y;
             stack.push( String.valueOf(result) );
    	 }
    	 else if( string[i].equals("-") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = y - x;
             stack.push( String.valueOf(result) );

    	 }
    	 else if( string[i].equals("*") ){
    		 int x = Integer.parseInt(stack.pop() );
    		 int y = Integer.parseInt(stack.pop() );
    		 int result = x * y;
             stack.push( String.valueOf(result) );
    	 }
    	 else{
    		 stack.push( string[i] );
    	 }
     }


     System.out.println(stack.pop());
 }
}

class Stack {
	int top = 0;
    int MAX = 200;
    String[] S = new String[200];


	void initialize(){
       top = 0;
    }

    boolean isEmpty(){
    	return top == 0;
    }


    boolean isFull(){
    	return top >= MAX - 1;
    }

    void push(String x ){

    	if(isFull()){System.out.println("??¨??????");}
    	top++;
        S[top] = x;

    }

    String pop(){
    	if(isEmpty()){System.out.println("??¨??????");}
    	top--;
    	return  S[top+1];
    }



}