#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main() {
char t[10];
char r[10];
int c = 0;
for (int i = 0; i < 10 && t[i] != 0; i++) {
if (isdigit(t
[i
]) || t
[i
] == 'i' || t
[i
] == 'p' || t
[i
] == '+' || t[i] == '-' || t[i] == '*' || t[i] == '/' || t[i] == '^') {
r[c++] = t[i];
}
}
r[c] = '\0';
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPGN0eXBlLmg+CgppbnQgbWFpbigpIHsKICAgIGNoYXIgdFsxMF07CiAgICBjaGFyIHJbMTBdOwogICAgZmdldHModCwgMTAsIHN0ZGluKTsKICAgIGludCBjID0gMDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTAgJiYgdFtpXSAhPSAwOyBpKyspIHsKICAgICAgICBpZiAoaXNkaWdpdCh0W2ldKSB8fCB0W2ldID09ICdpJyB8fCB0W2ldID09ICdwJyB8fCB0W2ldID09ICcrJyB8fCAKICAgICAgICAgICAgICAgIHRbaV0gPT0gJy0nIHx8IHRbaV0gPT0gJyonIHx8IHRbaV0gPT0gJy8nIHx8IHRbaV0gPT0gJ14nKSB7CiAgICAgICAgICAgIHJbYysrXSA9IHRbaV07CiAgICAgICAgfQogICAgfQogICAgcltjXSA9ICdcMCc7CiAgICBwcmludGYoIiVzIiwgcik7Cn0K