#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n, a[3], d[10], ans = 1e9;
bool vis[10];
void dfs(int pos, int n1, int n2, int n3) {
  ans = min(ans, abs(n1 - a[0]) + abs(n2 - a[1]) + abs(n3 - a[2]));
  if (pos == n) return;
  dfs(pos + 1, n1 + d[pos], n2, n3);
  dfs(pos + 1, n1, n2 + d[pos], n3);
  dfs(pos + 1, n1, n2, n3 + d[pos]);
}
int main() {
  cin >> n >> a[0] >> a[1] >> a[2];
  for (int i = 0; i < n; i++) cin >> d[i];
  dfs(0, 0, 0, 0);
  cout << ans + 10 * max(0, n - 3) << endl;
  return 0;
}
