def find_closest(pos, L):
    """
    (int, list) -> tuple
    
    :param pos: Position of interest along chromosome 0-based
    :param L: List of (positions, counts) 
    
    Returns a tuple (i, k) corresponding to the closest position i from pos
    and the highest count k if multiple counts exist for the smallest distance
    between pos and i
    """
    D = {}
    for i in L:
        dist = abs(pos - i[0])
        if dist in D:
            D[dist].append((i[1], i[0]))
        else:
            D[dist] = [(i[1], i[0])]
    for i in D:
        D[i].sort(key=lambda x: x[0])
    distances = sorted(D.keys())
    smallest_dist = distances[0]
    return smallest_dist, D[smallest_dist][-1][0], D[smallest_dist][-1][1]
