def median(array, length) -> int:
    if length % 2:
        return array[length//2]
    else:
        return (array[length//2 - 1] + array[length//2]) / 2


def merge(left_side, right_side, n, m) -> list:

    result = [None] * (n + m)

    i = 0
    j = 0
    k = 0

    while(i < n and j < m):
        if left_side[i] <= right_side[j]:
            result[k] = left_side[i]
            i += 1
        else:
            result[k] = right_side[j]
            j += 1
        k += 1

    while i < n:
        result[k] = left_side[i]
        i += 1
        k += 1

    while j < m:
        result[k] = right_side[j]
        j += 1
        k += 1

    return result


def merge_opt(left_side, right_side, n, m) -> list:
    length = m + n
    length_2 = length // 2 + 1
    result = [None] * length_2

    i = 0
    j = 0
    k = 0

    while(i < n and j < m and k < length_2):
        if left_side[i] <= right_side[j]:
            result[k] = left_side[i]
            i += 1
        else:
            result[k] = right_side[j]
            j += 1
        k += 1

    while i < n and k < length_2:
        result[k] = left_side[i]
        i += 1
        k += 1

    while j < m and k < length_2:
        result[k] = right_side[j]
        j += 1
        k += 1

    if length % 2:
        return result[-1]
    else:
        return (result[-1] + result[-2]) / 2


n = int(input())
m = int(input())

left_side = list(map(int, input().strip().split()))
right_side = list(map(int, input().strip().split()))

print(merge_opt(left_side, right_side, n, m))

# print(median(merge(left_side, right_side, n, m), n + m))

def median(array, length) -> int:
    if length % 2:
        return array[length//2]
    else:
        return (array[length//2 - 1] + array[length//2]) / 2


def merge(left_side, right_side, n, m) -> list:

    result = [None] * (n + m)

    i = 0
    j = 0
    k = 0

    while(i < n and j < m):
        if left_side[i] <= right_side[j]:
            result[k] = left_side[i]
            i += 1
        else:
            result[k] = right_side[j]
            j += 1
        k += 1

    while i < n:
        result[k] = left_side[i]
        i += 1
        k += 1

    while j < m:
        result[k] = right_side[j]
        j += 1
        k += 1

    return result


def merge_opt(left_side, right_side, n, m) -> list:
    length = m + n
    length_2 = length // 2 + 1
    result = [None] * length_2

    i = 0
    j = 0
    k = 0

    while(i < n and j < m and k < length_2):
        if left_side[i] <= right_side[j]:
            result[k] = left_side[i]
            i += 1
        else:
            result[k] = right_side[j]
            j += 1
        k += 1

    while i < n and k < length_2:
        result[k] = left_side[i]
        i += 1
        k += 1

    while j < m and k < length_2:
        result[k] = right_side[j]
        j += 1
        k += 1

    if length % 2:
        return result[-1]
    else:
        return (result[-1] + result[-2]) / 2


n = int(input())
m = int(input())

left_side = list(map(int, input().strip().split()))
right_side = list(map(int, input().strip().split()))

print(merge_opt(left_side, right_side, n, m))

# print(median(merge(left_side, right_side, n, m), n + m))

# print(median(merge(left_side, right_side, n, m), n + m))