import java.util.*;

public class Main {
	public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	}
}

class Stack
{
    public int top = 0;
    public int S[];

    public Stack(int n) {
        this.S = new int[n];
    }

    public void push(int x) throws Exception
    {
        if (this.isFull()) {
            throw new Exception();
        }
        this.S[++top] = x;
    }

    public int pop() throws Exception
    {
        if (this.isEmpty()) {
            throw new Exception();
        }
        this.top--;
        return S[this.top + 1];
    }

    private boolean isFull()
    {
        return this.top >= this.S.length - 1;
    }

    private boolean isEmpty()
    {
        return this.top == 0;
    }
} import java.util.*; util.* java public class Main {
	public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	}
} Main public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	} main {
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc sc.close() sc.close sc String[] str_arr = str.split(" "); str_arr str.split(" ") str.split str " " Stack stack = new Stack(200); stack new Stack(200) int a; a int b; b for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    } String s str_arr {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    } {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    } try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            } catch (Exception e) {
                System.out.println("error");
            } Exception e {
                System.out.println("error");
            } System.out.println("error") System.out.println System.out System System.out "error" {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                } s case "+": "+" case "+": b = stack.pop() b stack.pop() stack.pop stack a = stack.pop() a stack.pop() stack.pop stack stack.push(a + b) stack.push stack a + b a b break; case "-": "-" case "-": b = stack.pop() b stack.pop() stack.pop stack a = stack.pop() a stack.pop() stack.pop stack stack.push(a - b) stack.push stack a - b a b break; case "*": "*" case "*": b = stack.pop() b stack.pop() stack.pop stack a = stack.pop() a stack.pop() stack.pop stack stack.push(a * b) stack.push stack a * b a b break; default: default: stack.push(Integer.parseInt(s)) stack.push stack Integer.parseInt(s) Integer.parseInt Integer s try {
            System.out.println(stack.pop());
        } catch (Exception e) {} catch (Exception e) {} Exception e {} {
            System.out.println(stack.pop());
        } System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String args[] args class Stack
{
    public int top = 0;
    public int S[];

    public Stack(int n) {
        this.S = new int[n];
    }

    public void push(int x) throws Exception
    {
        if (this.isFull()) {
            throw new Exception();
        }
        this.S[++top] = x;
    }

    public int pop() throws Exception
    {
        if (this.isEmpty()) {
            throw new Exception();
        }
        this.top--;
        return S[this.top + 1];
    }

    private boolean isFull()
    {
        return this.top >= this.S.length - 1;
    }

    private boolean isEmpty()
    {
        return this.top == 0;
    }
} Stack public int top = 0; top 0 public int S[]; S public Stack(int n) {
        this.S = new int[n];
    } Stack {
        this.S = new int[n];
    } this.S = new int[n] this.S this this.S new int[n] n int n n public void push(int x) throws Exception
    {
        if (this.isFull()) {
            throw new Exception();
        }
        this.S[++top] = x;
    } push {
        if (this.isFull()) {
            throw new Exception();
        }
        this.S[++top] = x;
    } if (this.isFull()) {
            throw new Exception();
        } this.isFull() this.isFull this {
            throw new Exception();
        } throw new Exception(); new Exception() this.S[++top] = x this.S[++top] this.S this this.S ++top top x int x x public int pop() throws Exception
    {
        if (this.isEmpty()) {
            throw new Exception();
        }
        this.top--;
        return S[this.top + 1];
    } pop {
        if (this.isEmpty()) {
            throw new Exception();
        }
        this.top--;
        return S[this.top + 1];
    } if (this.isEmpty()) {
            throw new Exception();
        } this.isEmpty() this.isEmpty this {
            throw new Exception();
        } throw new Exception(); new Exception() this.top-- this.top this this.top return S[this.top + 1]; S[this.top + 1] S this.top + 1 this.top this this.top 1 private boolean isFull()
    {
        return this.top >= this.S.length - 1;
    } isFull {
        return this.top >= this.S.length - 1;
    } return this.top >= this.S.length - 1; this.top >= this.S.length - 1 this.top this this.top this.S.length - 1 this.S.length this.S this this.S this.S.length 1 private boolean isEmpty()
    {
        return this.top == 0;
    } isEmpty {
        return this.top == 0;
    } return this.top == 0; this.top == 0 this.top this this.top 0 public class Main {
	public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	}
} public class Main {
	public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	}
} Main
import java.util.*;

public class Main {
	public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    String str = sc.nextLine();
        sc.close();

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	}
}

class Stack
{
    public int top = 0;
    public int S[];

    public Stack(int n) {
        this.S = new int[n];
    }

    public void push(int x) throws Exception
    {
        if (this.isFull()) {
            throw new Exception();
        }
        this.S[++top] = x;
    }

    public int pop() throws Exception
    {
        if (this.isEmpty()) {
            throw new Exception();
        }
        this.top--;
        return S[this.top + 1];
    }

    private boolean isFull()
    {
        return this.top >= this.S.length - 1;
    }

    private boolean isEmpty()
    {
        return this.top == 0;
    }
}
