import java.io.*;

class Main {
	public static void main(String[] args) {
	    BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
	    try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	}
} import java.io.*; io.* java class Main {
	public static void main(String[] args) {
	    BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
	    try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	}
} Main public static void main(String[] args) {
	    BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
	    try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	} main {
	    BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
	    try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	} BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) ); kb new BufferedReader( new InputStreamReader( System.in ) ) try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    } catch( IOException e ) {
	        System.err.println( e );
	    } IOException e {
	        System.err.println( e );
	    } System.err.println( e ) System.err.println System.err System System.err e {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } int[] stack = new int[ 100+1 ]; stack new int[ 100+1 ] 100+1 100 1 int i i a a b; b String str = kb.readLine(); str kb.readLine() kb.readLine kb i = 0 i 0 for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    } String wd str.split( " " ) str.split str " " {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    } {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    } if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    } "+".equals( wd ) "+".equals "+" wd {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } b = stack[ --i ] b stack[ --i ] stack --i i a = stack[ --i ] a stack[ --i ] stack --i i stack[ i++ ] = a + b stack[ i++ ] stack i++ i a + b a b if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    } "-".equals( wd ) "-".equals "-" wd {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } b = stack[ --i ] b stack[ --i ] stack --i i a = stack[ --i ] a stack[ --i ] stack --i i stack[ i++ ] = a - b stack[ i++ ] stack i++ i a - b a b if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    } "*".equals( wd ) "*".equals "*" wd {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } b = stack[ --i ] b stack[ --i ] stack --i i a = stack[ --i ] a stack[ --i ] stack --i i stack[ i++ ] = a * b stack[ i++ ] stack i++ i a * b a b {
			    	stack[i++] = Integer.parseInt( wd );
			    } stack[i++] = Integer.parseInt( wd ) stack[i++] stack i++ i Integer.parseInt( wd ) Integer.parseInt Integer wd System.out.println( stack[ --i ] ) System.out.println System.out System System.out stack[ --i ] stack --i i String[] args args
import java.io.*;

class Main {
	public static void main(String[] args) {
	    BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
	    try {
			int[] stack = new int[ 100+1 ];
			int i, a, b;
		    String str = kb.readLine();
		    
		    i = 0;
		    for( String wd: str.split( " " ) ) {
			    if( "+".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a + b;			    
			    } else if( "-".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a - b;			    
			    } else if( "*".equals( wd ) ) {
			    	b = stack[ --i ];
			    	a = stack[ --i ];
			    	stack[ i++ ] = a * b;			    
			    } else {
			    	stack[i++] = Integer.parseInt( wd );
			    }
		    }

            System.out.println( stack[ --i ] );
	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	}
}