T=int(input()) H=set([str(i) for i in range(0,10)]) for i in range(T): s=input() flag=0 p=len(s)-1 q=len(s) for k in range(len(s)-1,-1,-1): if flag==0: if s[k] in H: q=k flag=1 if flag==1: if s[k] not in H: p=k flag=2 if flag==1: p=-1 t=s[:p+1] u=s[q+1:] v=s[p+1:q+1] if v: if v[0]=="0": v=str(int(v)+1).rjust(len(v),"0") else: v=str(int(v)+1) print(t+v+u)