object Main extends App {
  import scala.io.StdIn._

  val Array(n, a, b, c) = readLine.trim.split(' ').map(_.toInt)
  val lengths = Array.tabulate(n){_ ⇒ readInt()}
  println(
    (0 until (1 << (n * 2))).map(p ⇒ choice(p, n - 1, 0, 0, 0, 0)).min
  )
  def choice(pattern: Int, current: Int, forA: Int, forB: Int, forC: Int, usedMp: Int): Int = {
    if (current < 0) {
      if (forA * forB * forC == 0) Int.MaxValue
      else math.abs(forA - a) + math.abs(forB - b) + math.abs(forC - c) + usedMp
    }else {
      pattern % 4 match {
        case 0 ⇒ choice(pattern / 4, current - 1, forA, forB, forC, usedMp)
        case 1 if forA != 0 ⇒ choice(pattern / 4, current - 1, forA + lengths(current), forB, forC, usedMp + 10)
        case 1 ⇒ choice(pattern / 4, current - 1, lengths(current), forB, forC, usedMp)
        case 2 if forB != 0 ⇒ choice(pattern / 4, current - 1, forA, forB + lengths(current), forC, usedMp + 10)
        case 2 ⇒ choice(pattern / 4, current - 1, forA, lengths(current), forC, usedMp)
        case 3 if forC != 0 ⇒ choice(pattern / 4, current - 1, forA, forB, forC + lengths(current), usedMp + 10)
        case 3 ⇒ choice(pattern / 4, current - 1, forA, forB, lengths(current), usedMp)
        case _ ⇒ ???
      }
    }
  }
}