object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N, A, B, C = sc.nextInt
    val l = Array.fill[Int](N)(sc.nextInt)

    import Math.abs
    var result = Long.MaxValue

    def dfs(i: Int, mp: Int, a: Int, b: Int, c: Int): Unit = {
      if (i == N) {
        if (Array(a, b, c).min != 0) {
          val totalMp = mp + abs(A - a) + abs(B - b) + abs(C - c)
          if (totalMp < result) {
            result = totalMp
          }
        }
        return
      }
      dfs(i + 1, if (a != 0) mp + 10 else mp, a + l(i), b, c)
      dfs(i + 1, if (b != 0) mp + 10 else mp, a, b + l(i), c)
      dfs(i + 1, if (c != 0) mp + 10 else mp, a, b, c + l(i))
      dfs(i + 1, mp, a, b, c)
    }

    dfs(0, 0, 0, 0, 0)
    println(result)
  }
}