open Str;;

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

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

let rec toString (a, b) = string_of_int a ^ " " ^ string_of_int b;;

read_line()
|> Str.split (Str.regexp " ") 
|> List.map int_of_string
|> fun list -> (multiply 1 list, syuu 0 list);
|> toString
|> print_endline

