let rec multiply base list = match list with
    [] -> base
  | head :: tail -> multiply (base * head) tail;;

let rec add base list = match list with
    [] -> base
  | head :: tail -> add (base + head) tail;;

let rec toString base list = match list with
    [] -> base
  | head :: tail -> toString (base ^ " " ^ string_of_int head) tail;;

read_line()
|> Str.split (Str.regexp " ") 
|> List.map int_of_string
|> fun list -> [multiply 1 list; add 1 list];
|> toString ""
|> print_endline

