#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define MAX 100
char stack[MAX][MAX];
int top = -1;
void push(char str[]){
        strcpy(stack[++top],str);
        }
char* pop(){
   return stack[top--];
}
int isOperator(char ch){
    return(ch=='+' || ch=='-'|| ch=='*' || ch=='/');
}
int main()
{
    char prefix[MAX];
    scanf("%s",prefix);
    int len=strlen(prefix);
    for(int i=len-1;i>=0;i--){
        char ch
        char temp[2]={ch,'\0'};
        push(temp);
            
        }
        else if(isOperator(ch)){
            if(top<1){
                printf("Invalid input");
                return 0;
            }
                char op1[MAX],op2[MAX],exp[MAX];
            strcpy(op1,pop());
            strcpy(op2,pop());
            strcpy(exp,op1);
            strcat(exp,op2);
            int l=strlen(exp);
            exp[l]=ch;
            exp[l+1]='\0';
            push(exp);
        }
        else{
            printf("Invalid input");
            return 0;
        }
    }
    if(top !=0)
        printf("Invalid input");
        else
        printf("%s",stack[top]);
    return 0;
}