let getClass m xy = let xy' = xy - 1 in let isEven = (xy' / m) mod 2 = 0 in if isEven then xy' mod m else (m - 1) - (xy' mod m) let () = let _, m = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string |> (fun lst -> (List.nth lst 0, List.nth lst 1)) and x, y = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string |> (fun lst -> (List.nth lst 0, List.nth lst 1)) in let hanako = getClass m x and taro = getClass m y in (hanako = taro) |> (function | true -> "YES" | false -> "NO") |> print_endline