// editor5
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define max 25

char stack[max][max];
int top=0;
void push(char s[])
{
    strcpy(stack[top++],s);
}

char* pop()
{
    return stack[--top];
}

void fun(char c)
{
       char ca[2],c2[max],c3[max];
        ca[0]=c;
        ca[1]='\0';
        if(c=='+'||c=='-'||c=='*'||c=='/')
    {
        strcpy(c2,pop());
        strcpy(c3,pop());
        strcat(c2,c3);
        strcat(c2,ca);
        push(c2);
    }
    else
    {
        push(ca);
    }
}

void isvalid(char c)
{
    return (isalnum(c)||c=='+'||c=='-'||c=='*'||c=='/');
}

int main()
{
    char s[10];
    scanf("%s",s);
    for(int i=strlen(s)-1;i>=0;i--)
    {
        if(isvaild(s[i]))
        {
           fun(s[i]); 
        }
        else
        {
        printf("Invalid input");
        return 0;
        }
    }
    for(int i=0;i<top;i++)
    {
        printf("%s",stack[i]);
    }
    
}