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