let solve a_lst = let rec solve' lst result = match lst with | [] -> result | x::xs -> let result = match x with | n when n < 0 -> result - x | 0 | 1 -> result + x | _ -> result * x in solve' xs result in match a_lst with | x::xs -> solve' xs x | _ -> failwith "hoge" let () = let _ = read_line () and a_lst = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string in solve a_lst |> string_of_int |> print_endline