#include<iostream>
#include<stack>
#include<string>
using namespace std;
int to_num(string a) {
int res = 0;
for (int i = 0; i<a.length(); i++) {
res *= 10;
res += a[i] - '0';
}
return res;
}
int main() {
string a;
stack<string>op;
getline(cin, a);
for (int i = 0; i < a.length(); i++) {
if (a[i] == 'R')op.push("*");
else if (a[i] == 'F')op.push("+");
else if (a[i] == 'B')op.push("-");
else if (a[i] >= '0' && a[i] <= '9') {
string num = "";
int j;
for (j = i;j<a.length()&& a[j] >= '0' && a[j] <= '9'; j++)num += a[j];
op.push(num);
i = j-1;
}
}
long long res = 0;
while (!op.empty()) {
int num = to_num(op.top());
op.pop();
string sym = op.top();
op.pop();
if (sym == "+")res += num;
else if (sym == "-")res -= num;
else if (sym == "*")res *= num;
}
cout << res;
return 0;
}