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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    } main {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    } BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) String line = r.readLine(); line r.readLine() r.readLine r int opIndex = 0; opIndex 0 int[] ops = new int[100]; ops new int[100] 100 for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        } String elem line.split(" ") line.split line " " {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        } {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        } if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            } elem.equals("+") elem.equals elem "+" {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } ops[opIndex - 2] += ops[opIndex - 1] ops[opIndex - 2] ops opIndex - 2 opIndex 2 ops[opIndex - 1] ops opIndex - 1 opIndex 1 opIndex-- opIndex if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            } elem.equals("-") elem.equals elem "-" {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } ops[opIndex - 2] -= ops[opIndex - 1] ops[opIndex - 2] ops opIndex - 2 opIndex 2 ops[opIndex - 1] ops opIndex - 1 opIndex 1 opIndex-- opIndex if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            } elem.equals("*") elem.equals elem "*" {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } ops[opIndex - 2] *= ops[opIndex - 1] ops[opIndex - 2] ops opIndex - 2 opIndex 2 ops[opIndex - 1] ops opIndex - 1 opIndex 1 opIndex-- opIndex {
                ops[opIndex++] = Integer.parseInt(elem);
            } ops[opIndex++] = Integer.parseInt(elem) ops[opIndex++] ops opIndex++ opIndex Integer.parseInt(elem) Integer.parseInt Integer elem System.out.println(ops[0]) System.out.println System.out System System.out ops[0] ops 0 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String line = r.readLine();
        int opIndex = 0;
        int[] ops = new int[100];
        for (String elem : line.split(" ")) {
            if (elem.equals("+")) {
                ops[opIndex - 2] += ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("-")) {
                ops[opIndex - 2] -= ops[opIndex - 1];
                opIndex--;
            } else if (elem.equals("*")) {
                ops[opIndex - 2] *= ops[opIndex - 1];
                opIndex--;
            } else {
                ops[opIndex++] = Integer.parseInt(elem);
            }
        }
        System.out.println(ops[0]);
    }
}