#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstring>
#include<string>
#include<cctype>
#define itn int
using namespace std;
string s;int ans=0;
int main(){
freopen("expr2013.in","r",stdin);
freopen("expr2013.out","w",stdout);
cin>>s;long long a=0,b=0,c=0;
int len=s.size();bool flag1=0,flag2=0;
for (int i=0;i<len;i++){
if (flag1&&!flag2){
if (isdigit(s[i])) {b*=10;b+=s[i]-'0';b%=10000;}
else if (!isdigit(s[i+1])) {ans+=(a+b)%10000;}
}
if (flag2){
if (!isdigit(s[i+1])) {c+=(a%10000)*(b%10000);b=0;}
else if (isdigit(s[i])) {b*=10;b+=s[i]-'0';b%=10000;};
}
if (!flag2){
if (!flag1){
if (isdigit(s[i])) {a*=10;a+=s[i]-'0';a%=10000;}
else if (s[i]=='+') flag1=1;
else if (s[i]=='*') flag2=1;
}
}
}
printf("%lld",ans+b+c+a);
}