import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, a, b, c) = in.readLine.split(" ").map(_.toInt)
  val tLen = Iterator.continually(in.readInt)
    .take(n)
    .toArray

  val tar = Array(0, a, b, c)

  val ans = dfsEnum(tar.size, n)
  println(ans)
  
  def dfsEnum(d:Int, n:Int):Int = {
    // d進 n個列挙
    // n本の竹を 0:使わない 1:Aに使う 2:Bに使う 3:Cに使う の４進
    val enum = Array.ofDim[Int](n)
    var ret = Int.MaxValue
  
    def evalute():Unit = {
      if(!(1 to 3).forall(i => enum.exists(_ == i))) return
      var mp = 0
      val len = Array.ofDim[Int](d)
      for(j <- 0 until n if enum(j) != 0) {
        val i = enum(j)
        if(len(i) != 0) mp += 10
        len(i) += tLen(j)
      }
      mp += (1 to 3).map(i => (tar(i) - len(i)).abs).sum
      if(ret > mp) ret = mp
    }
  
    def dfs(cnt:Int):Unit = {
      if(cnt == n) evalute
      else {
        for(i <- 0 until d) {
          enum(cnt) = i
          dfs(cnt+1)
        }
      }
    }
  
    dfs(0)
    ret
  }
}