import java.util.*;
import java.util.ArrayDeque;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    }
} import java.util.*; util.* java import java.util.ArrayDeque; ArrayDeque java.util public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    } main {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        } {

            sc.close();

        } sc.close() sc.close sc {

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            } sc.hasNext() sc.hasNext sc {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            } String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc Deque<Integer> deq = new ArrayDeque<Integer>(); deq new ArrayDeque<Integer>() String[] s_array = str.split(" "); s_array str.split(" ") str.split str " " if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                } s_array.length > 2 s_array.length s_array s_array.length 2 {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                } for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    } int i = 0; int i = 0; i 0 i < s_array.length i s_array.length s_array s_array.length i++ i++ i {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    } {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    } if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        } s_array[i].toString().equals("*") s_array[i].toString().equals s_array[i].toString() s_array[i].toString s_array[i] s_array i "*" {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } deq.addFirst((deq.removeFirst() * deq.removeFirst())) deq.addFirst deq (deq.removeFirst() * deq.removeFirst()) deq.removeFirst() deq.removeFirst deq deq.removeFirst() deq.removeFirst deq if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        } s_array[i].toString().equals("/") s_array[i].toString().equals s_array[i].toString() s_array[i].toString s_array[i] s_array i "/" {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } int x = deq.removeFirst() x deq.removeFirst() deq.removeFirst deq y = deq.removeFirst(); y deq.removeFirst() deq.removeFirst deq deq.addFirst(y/x) deq.addFirst deq y/x y x if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        } s_array[i].toString().equals("+") s_array[i].toString().equals s_array[i].toString() s_array[i].toString s_array[i] s_array i "+" {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } deq.addFirst((deq.removeFirst() + deq.removeFirst())) deq.addFirst deq (deq.removeFirst() + deq.removeFirst()) deq.removeFirst() deq.removeFirst deq deq.removeFirst() deq.removeFirst deq if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        } s_array[i].toString().equals("-") s_array[i].toString().equals s_array[i].toString() s_array[i].toString s_array[i] s_array i "-" {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } int x = deq.removeFirst() x deq.removeFirst() deq.removeFirst deq y = deq.removeFirst(); y deq.removeFirst() deq.removeFirst deq deq.addFirst(y-x) deq.addFirst deq y-x y x {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        } deq.addFirst(Integer.valueOf(s_array[i].toString())) deq.addFirst deq Integer.valueOf(s_array[i].toString()) Integer.valueOf Integer s_array[i].toString() s_array[i].toString s_array[i] s_array i System.out.printf("%d\r\n", deq.removeFirst()) System.out.printf System.out System System.out "%d\r\n" deq.removeFirst() deq.removeFirst deq String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    }
} Main
import java.util.*;
import java.util.ArrayDeque;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);


        try{

            while (sc.hasNext()) {

                String str = sc.nextLine();
                Deque<Integer> deq = new ArrayDeque<Integer>();

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

                if (s_array.length > 2) {

                    for (int i = 0; i < s_array.length; i++) {

                        if (s_array[i].toString().equals("*")) {

                            deq.addFirst((deq.removeFirst() * deq.removeFirst()));

                        } else if (s_array[i].toString().equals("/")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y/x);

                        } else if (s_array[i].toString().equals("+")) {

                            deq.addFirst((deq.removeFirst() + deq.removeFirst()));

                        } else if (s_array[i].toString().equals("-")) {

                            int x = deq.removeFirst(), y = deq.removeFirst();
                            deq.addFirst(y-x);

                        } else {

                            deq.addFirst(Integer.valueOf(s_array[i].toString()));

                        }
                    }

                    System.out.printf("%d\r\n", deq.removeFirst());

                }

            }

        } finally {

            sc.close();

        }

    }
}
