#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair P; #define rep(i, n) for (int i=0; i<(n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define _1 first #define _2 second #define pb push_back #define INF 1145141919 #define MOD 1000000007 int T; signed main() { ios::sync_with_stdio(false); cin.tie(0); cin >> T; string s; getline(cin, s); rep(_, T) { getline(cin, s); int offset = -1; rep(i, s.length()) { char c = s[i]; if (c >= '0' && c <= '9') offset = i; } if (offset == -1) { cout << s << "\n"; continue; } bool ok = false; while (offset >= 0 && s[offset] >= '0' && s[offset] <= '9') { if (s[offset] != '9') { s[offset]++; ok = true; break; } s[offset] = '0'; offset--; } string o = ""; if (ok) o = s; else { rep(i, offset+1) { o += s[i]; } o += '1'; for (int i=offset+1; i<=s.length(); i++) o += s[i]; } cout << o << "\n"; } return 0; }