#include <iostream>
#include <vector>
#include <iterator>
#include <cmath>
#include <algorithm>

int N, A, B, C;
std::vector<int> l;

int dfs(int n, int a, int b, int c){
  if(n == N){
    if(std::min( {a, b, c} ) > 0){
      return std::fabs(a - A) + std::fabs(b - B) + std::fabs(c - C) - 30;
    }else{
      return 100000;
    }
  }

  int mp1 = dfs(n + 1, a, b, c);
  int mp2 = dfs(n + 1, a + l[n], b, c) + 10;
  int mp3 = dfs(n + 1, a, b + l[n] ,c) + 10;
  int mp4 = dfs(n + 1, a, b, c + l[n]) + 10;
  return min( {mp1, mp2, mp3, mp4} );
}

int main(){
  std::cin >> N >> A >> B >> C;
  std::copy_n(std::istream_iterator<int>(std::cin), N, std::back_inserter(l));
  std::cout << dfs(0, 0, 0, 0) << std::endl;
  return 0;
}
