#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  ;
  int n, m1, m2, m3, minv1 = 10000, minv2 = 10000, minv3 = 10000, s1 = 0,
                     s2 = 0, s3 = 0;
  cin >> n >> m1 >> m2 >> m3;
  int a[n + 1], f[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[i] = 0;
  }
  f[0] = 1;
  while (f[0]) {
    int j = n;
    while (f[j] == 1 && j >= 0) {
      f[j] = 0;
      j--;
    }
    f[j] = 1;
    int m = -1, s = 0;
    for (int i = 1; i <= n; i++) {
      if (f[i]) {
        m++;
        s += a[i];
      }
    }
    if (minv1 + s1 * 10 > fabs(m1 - s) + m * 10) {
      minv1 = fabs(m1 - s);
      s1 = m;
    }
    if (minv2 + s2 * 10 > fabs(m2 - s) + m * 10) {
      minv2 = fabs(m2 - s);
      s2 = m;
    }
    if (minv3 + s3 * 10 > fabs(m3 - s) + m * 10) {
      minv3 = fabs(m3 - s);
      s3 = m;
    }
  }
  cout << s1 * 10 + s2 * 10 + s3 * 10 + minv1 + minv2 + minv3;
}
