Scanf.scanf "%d %d %d %d" (fun a b c d ->
    let l1 = if a <= 0 && 0 <= b then [| a; 0; b |] else [| a; a; b |] in
    let l2 = if c <= 0 && 0 <= d then [| c; 0; d |] else [| c; c; d |] in

    let rec loop_i i acc =
        let rec loop_j j acc =
            if j = 3 then loop_i (i + 1) acc else
                loop_j (j + 1) (max acc (l1.(i) * l2.(j)))
        in
        if i = 3 then acc else loop_j 0 acc
    in
    loop_i 0 min_int |> Printf.printf "%d\n"
)