/**
 * Created by IntelliJ IDEA.
 * User: m09aaa
 * Date: 25.11.2009
 * Time: 18:24:59
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;

public class Postfix {
    static int Oper(int x, int y, char oper)
    {
        int xy=0;
        if (oper=='+')
        {
            xy=x+y;
        }
        if (oper=='-')
        {
            xy=x-y;
        }
        if (oper=='*')
        {
            xy=x*y;
        }
        return xy;
    }
     public static void main(String [] args) throws Exception{
         Scanner in=new Scanner(new File("postfix.in"));
         PrintWriter out=new PrintWriter(new File("postfix.out"));
         String s=in.nextLine();
         LinkedList<Character> sign=new LinkedList<Character>();
         LinkedList<Integer> num=new LinkedList<Integer>();


             for (int i=0; i<s.length(); i++)
            {
                if (s.charAt(i)=='+'||s.charAt(i)=='-'||s.charAt(i)=='*')
                {
                    sign.addLast(s.charAt(i));
                    num.addLast(0);
                }
                 else
                 {
                    sign.addLast('0');
                    num.addLast(s.charAt(i)-'0');
                }
             }
         while (sign.size()!=1)
         {
             int i=2;
             boolean was=true;
             while (was&&i<sign.size())
             {
                 if (sign.get(i)!='0')
                 {
                     int a=Oper(num.get(i-2), num.get(i-1), sign.get(i));
                     sign.remove(i-1);sign.remove(i-1);
                     num.remove(i-2); num.remove(i-2);  num.remove(i-2);
                     num.add(i-2, a);
                     was=false;
                 }
                 else {i++;}
             }
         }
         out.println(num.getFirst());
         out.close();
     }
}
