import java.util.*;
import java.io.IOException;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    }
    public static boolean isNumber(String num) {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
}
}

 import java.util.*; util.* java import java.io.IOException; IOException java.io public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    }
    public static boolean isNumber(String num) {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
}
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    } main {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Integer> list = new ArrayList<>(); list new ArrayList<>() String[] a = new String[1000]; a new String[1000] 1000 int i = 0; i 0 a[i] = sc.next() a[i] a i sc.next() sc.next sc try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        } catch(Exception e){
            
        } Exception e {
            
        } {
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        } while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            } a[i] != null a[i] a i null {
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            } boolean b = isNumber(a[i]); b isNumber(a[i]) isNumber a[i] a i if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                } b {
                    list.add(Integer.parseInt(a[i]));
                } list.add(Integer.parseInt(a[i])) list.add list Integer.parseInt(a[i]) Integer.parseInt Integer a[i] a i {
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                } if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    } a[i].equals("+") a[i].equals a[i] a i "+" {
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    } list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2)) list.set list list.size()- 2 list.size() list.size list 2 list.get(list.size()- 1) + list.get(list.size()- 2) list.get(list.size()- 1) list.get list list.size()- 1 list.size() list.size list 1 list.get(list.size()- 2) list.get list list.size()- 2 list.size() list.size list 2 list.remove(list.size()-1) list.remove list list.size()-1 list.size() list.size list 1 if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    } a[i].equals("-") a[i].equals a[i] a i "-" {
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    } list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1)) list.set list list.size()- 2 list.size() list.size list 2 list.get(list.size()- 2) - list.get(list.size()- 1) list.get(list.size()- 2) list.get list list.size()- 2 list.size() list.size list 2 list.get(list.size()- 1) list.get list list.size()- 1 list.size() list.size list 1 list.remove(list.size()- 1) list.remove list list.size()- 1 list.size() list.size list 1 {
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    } list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2)) list.set list list.size()- 2 list.size() list.size list 2 list.get(list.size()- 1) * list.get(list.size()- 2) list.get(list.size()- 1) list.get list list.size()- 1 list.size() list.size list 1 list.get(list.size()- 2) list.get list list.size()- 2 list.size() list.size list 2 list.remove(list.size()- 1) list.remove list list.size()- 1 list.size() list.size list 1 i++ i a[i] = sc.next() a[i] a i sc.next() sc.next sc System.out.println(list.get(0)) System.out.println System.out System System.out list.get(0) list.get list 0 String[] args args public static boolean isNumber(String num) {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
} isNumber {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
} try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    } catch (NumberFormatException e) {
        return false;
    } NumberFormatException e {
        return false;
    } return false; false {
        Integer.parseInt(num);
        return true;
        } Integer.parseInt(num) Integer.parseInt Integer num return true; true String num num public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    }
    public static boolean isNumber(String num) {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
}
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    }
    public static boolean isNumber(String num) {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
}
} Main
import java.util.*;
import java.io.IOException;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String[] a = new String[1000];
        int i = 0;
        a[i] = sc.next();
            try{
                while(a[i] != null){
                    boolean b = isNumber(a[i]);
                if(b){
                    list.add(Integer.parseInt(a[i]));
                }else{
                    if(a[i].equals("+")){
                        list.set(list.size()- 2, list.get(list.size()- 1) + list.get(list.size()- 2));
                        list.remove(list.size()-1);
                    }else if(a[i].equals("-")){
                        list.set(list.size()- 2, list.get(list.size()- 2) - list.get(list.size()- 1));
                        list.remove(list.size()- 1);
                    }else{
                        list.set(list.size()- 2, list.get(list.size()- 1) * list.get(list.size()- 2));
                        list.remove(list.size()- 1);
                    }
                }
                i++;
                a[i] = sc.next();
            }
                
        }catch(Exception e){
            
        }
            
        System.out.println(list.get(0));
    }
    public static boolean isNumber(String num) {
    try {
        Integer.parseInt(num);
        return true;
        } catch (NumberFormatException e) {
        return false;
    }
}
}


