type hyper_int = Fin of int | Inf
let str_of_hyper_int = function Fin i -> string_of_int i | Inf -> "Inf"
let min x y = if x = Inf then y else if y = Inf then x else min x y
let min_of_list ls =
  let rec inner acc = function [] -> acc | l::ls -> inner (min l acc) ls
  in inner Inf ls
let add x y = match x, y with Fin x, Fin y -> Fin (x + y) | _, _ -> Inf

let solve bamboos a b c =
  let rec inner bamboos a' b' c' =
    match bamboos with
    | [] ->
       if a' = 0 || b' = 0 || c' = 0 then Inf
       else Fin ((abs @@ a - a') + (abs @@ b - b') + (abs @@ c - c') - 30)
    | l::ls -> 
       let use_as_a = add (Fin 10) (inner ls (a' + l) b' c') in
       let use_as_b = add (Fin 10) (inner ls a' (b' + l) c') in
       let use_as_c = add (Fin 10) (inner ls a' b' (c' + l)) in
       let not_use  = inner ls a' b' c' in
       min_of_list [use_as_a; use_as_b; use_as_c; not_use]
  in inner bamboos 0 0 0

let _ =
  let n, a, b, c = Scanf.scanf "%d %d %d %d\n" (fun n a b c -> n, a, b, c) in
  let bamboos = ref [] in
  for i = 0 to n - 1 do
    Scanf.scanf "%d\n" (fun b -> bamboos := b::!bamboos)
  done;
  solve !bamboos a b c
  |> str_of_hyper_int
  |> print_string