n = input() for i in range(n): s = raw_input() tmp = "" raw = [0, 0] dot = 0 for j in reversed(range(len(s))): ac = ord(s[j]) if ac >= 48 and ac <= 57: if raw[1] == 0: raw[1] = j tmp += s[j] elif ac == 46: if j - 1 >= 0: if ord(s[j - 1]) >=48 and ord(s[j - 1]) <= 57: tmp += s[j] dot = 1 elif len(tmp) > 0: if raw[0] == 0: raw[0] = j + 1 break tmp = tmp[::-1] if dot == 0: ans = int(tmp) ans += 1 a = "" a += s[0:raw[0]] a += str(ans) if len(a) != len(s): a += s[raw[1]:] print a else: a = "0." for i in reversed(range(len(tmp))): if tmp[i - 1] != '.': a += '0' else: a += '1' break ans = float(tmp) + float(a) a = str(ans) while len(a) != len(tmp): a += '0' b = "" b += s[0:raw[0]] b += a if len(b) != len(s): b += s[raw[1]:] print b