#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#define max 25

char stack[max][max];
int top = -1;

void push(char ch[]){
    strcpy(stack[++top],ch);
}

char* pop(){
    return stack[top--];
}

void func(char *str){
    int len = strlen(str), i;
    for(i=0;i<len;i--){
        char ch = str[i];
        if(isalnum(ch)){
            char temp[2];
            temp[0] = ch;
            temp[1] = '\0';
            push(temp);
        }
        // else if(!(ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '(' || ch == ')')){
        //     printf("Invalid input");
        //     exit(0);
        // }
        else if(ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '(' || ch == ')'){
            char op1[max],op2[max],res[max];
            strcpy(op2,pop());
            strcpy(op1,pop());
            sprintf(res,"%c%s%s",ch,op1,op2);
            push(res);
        }
    }
}

int main(){
    char str[max];
    scanf("%s",str);
    func(str);
    
    printf("%s",stack[top]);
}