import sys sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inl = lambda: [int(x) for x in sys.stdin.readline().split()] ins = lambda: sys.stdin.readline().rstrip() debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) def solve(): n = ini() A = inl() B = inl() def f(x): res = 0 for i in range(n): res += B[i] * abs(x - A[i]) return res lo, hi, fhi = -(10 ** 9), 10 ** 9, None for i in range(100): x = lo + (hi - lo) / 3.0 y = lo + (hi - lo) * 2.0 / 3.0 fx, fy = f(x), f(y) if fx > fy: lo = x else: hi = y fhi = fy return "{:.9f}".format(hi), int(fhi + 0.5) print(*solve())