Solved pb003, OCaml way