#include <bits/stdc++.h>
using namespace std;
static int N = 0;
int A, B, C;
vector<int> l;
int dfs(int pos, int a, int b, int c) {
  if (pos == N) {
    int ans = 0;
    ans = abs(A - a) + abs(B - b) + abs(C - c) - 30;
    return ans;
  }
  int ret1, ret2, ret3, ret4;
  ret1 = dfs(pos + 1, a, b, c);
  ret2 = dfs(pos + 1, a + l[pos], b, c) + 10;
  ret3 = dfs(pos + 1, a, b + l[pos], c) + 10;
  ret4 = dfs(pos + 1, a, b, c + l[pos]) + 10;
  return min({ret1, ret2, ret3, ret4});
}
int main() {
  int a, b, c;
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int num;
    cin >> num;
    l.push_back(num);
  }
  cout << dfs(0, 0, 0, 0) << endl;
}
