只过了1,4
#include<iostream>
#include<string>
#include<stack>
using namespace std;
string s;
typedef long long LL;
stack<LL> st;
LL sum;
int main(){
cin>>s;
bool b=0;
for(int i=0;i<s.size();i++)
{
LL t=0;
while(s[i]>='0'&&s[i]<='9')
{
t*=10;
t+=(s[i]-'0');
i++;
}
if(b==0) st.push(t);
else
{
LL m=st.top();
st.pop();
st.push(m*t);
b=0;
}
if(i>=s.size()) break;
if(s[i]=='+') continue;
if(s[i]=='*') b=1;
}
while(!st.empty())
{
LL temp=st.top();
st.pop();
sum+=temp;
sum%=10000;
}
cout<<sum;
}