local mfl, mce = math.floor, math.ceil local q = io.read("*n", "*l") local ps, ms = {}, {} for i = 1, 25 do ps[i] = 0 ms[i] = 0 end for iq = 1, q do local s = io.read() local t = nil if s:sub(1, 1) == "-" then t = ms s = s:sub(2, #s) else t = ps end if s:find("%.") then local s1, s2 = s:match("(%d+)%.(%d+)") for i = 1, #s2 do local v = s2:sub(i, i):byte() - 48 t[i + 15] = t[i + 15] + v end for i = 1, #s1 do local v = s1:sub(i, i):byte() - 48 t[15 - #s1 + i] = t[15 - #s1 + i] + v end else for i = 1, #s do local v = s:sub(i, i):byte() - 48 t[15 - #s + i] = t[15 - #s + i] + v end end end for i = 25, 2, -1 do if 10 <= ps[i] then local up = mfl(ps[i] / 10) ps[i] = ps[i] % 10 ps[i - 1] = ps[i - 1] + up end if 10 <= ms[i] then local up = mfl(ms[i] / 10) ms[i] = ms[i] % 10 ms[i - 1] = ms[i - 1] + up end end local t1, t2 = nil, nil local flag = true for i = 1, 25 do if ms[i] < ps[i] then break elseif ps[i] < ms[i] then flag = false break end end if flag then t1, t2 = ps, ms else t1, t2 = ms, ps end for i = 25, 2, -1 do t1[i] = t1[i] - t2[i] while t1[i] < 0 do t1[i] = t1[i] + 10 t1[i - 1] = t1[i - 1] - 1 end end if not flag then io.write("-") end local first_point = 15 for i = 1, 14 do if 0 < t1[i] then first_point = i break end end for i = first_point, 15 do io.write(t1[i]) end io.write(".") for i = 16, 25 do io.write(t1[i]) end io.write("\n")