import scala.io.StdIn._

object Main extends App {

  val Array(n,la,lb,lc) = readLine().split(" ").map(_.toInt)
  val l = Array.fill(n)(readInt())

  def solve() = {
    dfs(0,0,0,0)
  }

  def dfs(depth: Int, a: Int, b: Int, c: Int): Int = {
    if(depth == n) {
      if(Seq(a,b,c).min == 0) Int.MaxValue
      else (la - a).abs + (lb - b).abs + (lc - c).abs - 30
    }
    val ret0 = dfs(depth+1, a, b, c)
    val ret1 = dfs(depth+1, a +l(depth), b, c) + 10
    val ret2 = dfs(depth+1, a, b +l(depth), c) + 10
    val ret3 = dfs(depth+1, a, b, c +l(depth)) + 10
    Seq(ret0, ret1, ret2, ret3).min
  }

  println(solve())

}

