#include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int Q;cin>>Q; for(;Q--;) { string S;cin>>S; long ans=0; if(S.size()==1)ans=S[0]-'0'; else if(S[1]=='b') {//2 for(int i=2;i