pub fn bin_position1_4<S: Ord, T: Ord, U: Ord, V: Ord>(
    x: &[(S, T, U, V)],
    d: &S
) -> i32