using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Numerics; using BI = System.Numerics.BigInteger; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ for(int i=0;i=0;j--){ if(!found){ if(InRange(s[j],'0','9'+1)){ r = j; l = j; found = true; continue; } else { continue; } } if(found){ if(InRange(s[j],'0','9'+1)){ l = j; continue; } else { break; } } } if(!found){ Console.WriteLine(s); continue; } String left = s.Substring(0,l); String mid = s.Substring(l,(r-l+1)); String right = s.Substring(r+1); char[] ca = mid.ToCharArray(); int carry = 1; int m = ca.Length; for(int j=m-1;j>=0;j--){ ca[j] = (char)(ca[j] + carry); carry = 0; if(!InRange(ca[j],'0','9'+1)){ ca[j] = '0';carry = 1; } } var nmid = carry == 1 ? "1" : ""; nmid = nmid + new String(ca); Console.WriteLine(left + nmid + right); } } bool InRange(int t, int l, int r){ return l <= t && t < r; } int N; String[] S; public Sol(){ N = ri(); S = new String[N]; for(int i=0;iint.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }