#include <iostream>
using namespace std;
int main() {
int x = 0, a;
string s;
while (cin >> s){
if (s == "multiply") {
cin >> a;
x*=a;
}
if (s == "subtract") {
cin >> a;
x-=a;
}
if (s == "add") {
cin >> a;
x+=a;
}
}
cout << x;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgeCA9IDAsIGE7CglzdHJpbmcgczsKCXdoaWxlIChjaW4gPj4gcyl7CgkJaWYgKHMgPT0gIm11bHRpcGx5IikgewoJCQljaW4gPj4gYTsKCQkJeCo9YTsKCQl9CgkJaWYgKHMgPT0gInN1YnRyYWN0IikgewoJCQljaW4gPj4gYTsKCQkJeC09YTsKCQl9CgkJaWYgKHMgPT0gImFkZCIpIHsKCQkJY2luID4+IGE7CgkJCXgrPWE7CgkJfQoJfQoJY291dCA8PCB4OwoJcmV0dXJuIDA7Cn0=