#include using namespace std; int main() { int N; cin >> N; string S; vector T; getline(cin, S); for(int i = 0; i < N; i++) { bool carry = true; bool found = false; getline(cin, S); T = vector(); for(int j = S.length() - 1; j >= 0; j--) { if( 0x30 <= S[j] && S[j] <= 0x39) { if(carry) { int n = S[j] - 0x30; if(n != 9) { carry = false; S[j]++; } else { S[j] = 0x30; } } found = true; } else { if(found && carry) { T.push_back('1'); carry = false; } } T.push_back(S[j]); } reverse(T.begin(), T.end()); S = string(T.begin(), T.end()); cout << S << endl; } return 0; }