def Main(): n=int(input()) for _ in range(n): s=input() for i in range(5): if s[i]!="0": print(s[i:]) break elif i==4: print(0) Main()