let n, a, b, c = Scanf.scanf " %d %d %d %d" @@ fun n a b c -> n, a, b, c
let ls = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let f m l =
  let len = ref 0 in
  let c = ref 0 in
  for i = 0 to n - 1 do
    if m lsr i land 1 = 1 then
      (len := !len + ls.(i); incr c)
  done;
  max 0 (!c - 1) * 10 + (abs @@ l - !len)
let g i j k = f i a + f j b + f k c
let ans = ref max_int
let _ =
  for i = 1 to 255 do
    for j = 1 to 255 do
      if i land j = 0 then
        for k = 1 to 255 do
          if i land k = 0 && j land k = 0 then
            ans := min !ans @@ g i j k
        done
    done
  done;
  Printf.printf "%d\n" !ans