#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

int N, A, B, C;
int l[8];
int ans = 1e9;

int dfs(int d, int a, int b, int c) {
  if(d == N) {
    if(a && b && c) return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    else return 1e9;
  }
  int ret = min(dfs(d + 1, a, b, c), dfs(d + 1, a + l[d], b, c) + 10);
  int ret2 = min(dfs(d + 1, a, b + l[d], c) + 10, dfs(d + 1, a, b, c + l[d]) + 10);
  return min(ret, ret2);
}

int main() {
  cin >> N >> A >> B >> C;
  rep(i, 0, N) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << "\n";
  return 0;
}
