```
#include<bits/stdc++.h>
#define ll long long
using namespace std;
stack<ll>a;
char cc,c;
ll shu(){
ll temp=0;
c=getchar();
while(c>='0' && c<='9'){
temp=temp*10+c-'0';
c=getchar();
}
temp%=10000;
cc=c;
return temp;
}
int main(){
a.push(shu());
while(cc!='\n'){
if(cc=='*'){
int x=shu()*a.top()%10000;
a.pop();
a.push(x);
}
else a.push(shu());
}
ll sum=0;
while(!a.empty()){
sum=(sum+a.top())%10000;
a.pop();
}
cout<<sum;
return 0;
}
```
by SHUYONGRUI @ 2024-02-04 10:14:02