import java.util.Scanner;

public class Main {

    int current = 0;
    int[] stack = new int[101];

    public void go() {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    }

    public static void main(String[] args) {
        Main cui = new Main();
        cui.go();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    int current = 0;
    int[] stack = new int[101];

    public void go() {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    }

    public static void main(String[] args) {
        Main cui = new Main();
        cui.go();
    }
} Main int current = 0; current 0 int[] stack = new int[101]; stack new int[101] 101 public void go() {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    } go {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] strs = line.split(" "); strs line.split(" ") line.split line " " for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        } String str strs {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        } {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        } char ch = str.charAt(0); ch str.charAt(0) str.charAt str 0 if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            } '0' <= ch && ch <= '9' '0' <= ch '0' ch ch <= '9' ch '9' {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } this.stack[this.current] = Integer.parseInt(str) this.stack[this.current] this.stack this this.stack this.current this this.current Integer.parseInt(str) Integer.parseInt Integer str this.current++ this.current this this.current {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            } switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                } ch case '+': '+' case '+': this.stack[current - 2] += this.stack[current - 1] this.stack[current - 2] this.stack this this.stack current - 2 current 2 this.stack[current - 1] this.stack this this.stack current - 1 current 1 this.stack[current] = 0 this.stack[current] this.stack this this.stack current 0 this.current-- this.current this this.current break; case '-': '-' case '-': this.stack[current - 2] -= this.stack[current - 1] this.stack[current - 2] this.stack this this.stack current - 2 current 2 this.stack[current - 1] this.stack this this.stack current - 1 current 1 this.stack[current] = 0 this.stack[current] this.stack this this.stack current 0 this.current-- this.current this this.current break; case '*': '*' case '*': this.stack[current - 2] *= this.stack[current - 1] this.stack[current - 2] this.stack this this.stack current - 2 current 2 this.stack[current - 1] this.stack this this.stack current - 1 current 1 this.stack[current] = 0 this.stack[current] this.stack this this.stack current 0 this.current-- this.current this this.current break; sc.close() sc.close sc System.out.println(this.stack[current - 1]) System.out.println System.out System System.out this.stack[current - 1] this.stack this this.stack current - 1 current 1 public static void main(String[] args) {
        Main cui = new Main();
        cui.go();
    } main {
        Main cui = new Main();
        cui.go();
    } Main cui = new Main(); cui new Main() cui.go() cui.go cui String[] args args public class Main {

    int current = 0;
    int[] stack = new int[101];

    public void go() {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    }

    public static void main(String[] args) {
        Main cui = new Main();
        cui.go();
    }
} public class Main {

    int current = 0;
    int[] stack = new int[101];

    public void go() {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    }

    public static void main(String[] args) {
        Main cui = new Main();
        cui.go();
    }
} Main
import java.util.Scanner;

public class Main {

    int current = 0;
    int[] stack = new int[101];

    public void go() {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        for (String str : strs) {
            char ch = str.charAt(0);
            if ('0' <= ch && ch <= '9') {
                this.stack[this.current] = Integer.parseInt(str);
                this.current++;
            } else {
                switch (ch) {
                case '+':
                    this.stack[current - 2] += this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '-':
                    this.stack[current - 2] -= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                case '*':
                    this.stack[current - 2] *= this.stack[current - 1];
                    this.stack[current] = 0;
                    this.current--;
                    break;
                }
            }
        }
        sc.close();
        System.out.println(this.stack[current - 1]);
    }

    public static void main(String[] args) {
        Main cui = new Main();
        cui.go();
    }
}
