let rom_to_int s = match s with | "I" -> 1 | "II" -> 2 | "III" -> 3 | "IIII" -> 4 | "V" -> 5 | "VI" -> 6 | "VII" -> 7 | "VIII" -> 8 | "IX" -> 9 | "X" -> 10 | "XI" -> 11 | "XII" -> 0 | _ -> assert false let int_to_rom n = match n with | 1 -> "I" | 2 -> "II" | 3 -> "III" | 4 -> "IIII" | 5 -> "V" | 6 -> "VI" | 7 -> "VII" | 8 -> "VIII" | 9 -> "IX" | 10 -> "X" | 11 -> "XI" | 0 -> "XII" | _ -> assert false let () = let s, t = Scanf.scanf "%s %d " (fun s t -> s, t) in let x = (rom_to_int s + t) mod 12 in let x = x + if x >= 0 then 0 else 12 in int_to_rom x |> print_endline