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