撒旦baihaojun非要A
推荐你去听鸟叔的江南style
#include <iostream>
using namespace std;
int main() {
char s[100005];
cin.getline(s, 100005);
int l = 0, r = 0, n = 0, a = 0, b = 0, c = 0;
long long p = 1, t = 0;
for (int i = 0; s[i]; i++) {
if (s[i] >= '0' && s[i] <= '9') {
t = t * 10 + (s[i] - '0');
if (t >= 10000) t %= 10000;
} else {
p = (p * t) % 10000;
t = 0;
if (s[i] == '+') {
a = (a + p) % 10000;
p = 1;
}
}
}
p = (p * t) % 10000;
a = (a + p) % 10000;
if (a >= 1000) cout << a << endl;
else if (a >= 100) cout << a << endl;
else if (a >= 10) cout << a << endl;
else cout << a << endl;
return 0;
}