#include using namespace std; using ll = long long; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b=0; i--){ ll v = ctoi(s[i]) + ctoi(t[i]) + carry; if(v>9){ carry = 1; v = v%10; }else{ carry = 0; } ss << v; } if(carry==1){ ss << 1; } string ret = ss.str(); reverse(ALL(ret)); return ret; } void string_add_test(){ auto a = string_add("111", "999"); pn(a); auto b = string_add("1234", "10"); pn(b); } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll T; cin >> T; string dustbox; getline(cin, dustbox); while(T--){ string s; //cin >> s; getline(cin, s); ll L = s.size(); // head -- num -- tail ll i; for(i=L-1; i>=0; i--){ if(isdigit(s[i])){ break; } } ll tail_i = i+1; // if number nothing if(tail_i==0){ p(s); continue; } for(i=tail_i-1; i>=0; i--){ if(!isdigit(s[i])) break; } ll num_i = i+1; string head = s.substr(0, num_i); string num = s.substr(num_i, tail_i-num_i); string tail = s.substr(tail_i); stringstream ss; ss << head; ss << string_add(num, "1"); ss << tail; string ans = ss.str(); p(ans); } return 0; }