#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, d[10], e[10], ans = 1LL << 62;
void cal() {
  long long A = 0, B = 0, C = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    if (e[i] == 1) {
      if (A != 0) {
        sum += 10;
      }
      A += d[i];
    } else if (e[i] == 2) {
      if (B != 0) {
        sum += 10;
      }
      B += d[i];
    } else if (e[i] == 3) {
      if (C != 0) {
        sum += 10;
      }
      C += d[i];
    }
  }
  if (A == 0 && B == 0 && C == 0) {
    return;
  }
  sum += abs(A - a) + abs(B - b) + abs(C - c);
  ans = min(sum, ans);
}
void dep(long long now) {
  if (now == n) {
    cal();
    return;
  }
  e[now] = 0;
  dep(now + 1);
  e[now] = 1;
  dep(now + 1);
  e[now] = 2;
  dep(now + 1);
  e[now] = 3;
  dep(now + 1);
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  dep(0);
  cout << ans;
  return 0;
}
