import scala.io.{StdIn => in}

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

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

  val ans = {
    val enum = Array.ofDim[Int](n)
    var min = 10000000

    def evalute():Unit = {
      if(!(0 until 3).forall(i => enum.exists(_==w(i)))) {
        // println(enum.mkString(" "))
        return
      }
      var res = 0
      for(i <- 0 until 3) {
        var v = 0
        var isFirst = true
        for(j <- 0 until n if enum(j) == w(i)) {
          v += t(j)
          if(isFirst) isFirst = false
          else res += 10
        }
        res += (w(i) - v).abs
      }
      if(min > res) min = res
    }

    def bfs(cnt:Int):Unit = {
      if(cnt == n) evalute
      else {
        for(i <- 0 until 4) {
          enum(cnt) = w(i)
          bfs(cnt+1)
        }
      }
    }
    
    bfs(0)
    min
  }

  println(ans)
}