#include <bits/stdc++.h>
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF = (long long)1E17;
long mod(long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
using namespace std;
bool prime_(int n) {
  if (n == 1) {
    return false;
  } else if (n == 2) {
    return true;
  } else {
    for (int i = 2; i <= sqrt(n); i++) {
      if (n % i == 0) {
        return false;
      }
    }
    return true;
  }
}
long long gcd_(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  if (a % b == 0) {
    return b;
  } else {
    return gcd_(b, a % b);
  }
}
long long lcm_(long long x, long long y) { return (x / gcd_(x, y)) * y; }
class UnionFind {
 public:
  vector<int> Parent;
  UnionFind(int N) { Parent = vector<int>(N, -1); }
  int root(int A) {
    if (Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  int size(int A) { return -Parent[root(A)]; }
  bool connect(int A, int B) {
    A = root(A);
    B = root(B);
    if (A == B) {
      return false;
    }
    if (size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
};
int dfs(vector<int> l, int i, int a, int b, int c, int A, int B, int C,
        int current) {
  int n = l.size();
  int res;
  if (i == n) {
    if (a == 0 || b == 0 || c == 0) {
      res = INT_MAX;
    } else {
      res = current + abs(a - A) + abs(b - B) + abs(c - C);
    }
  } else {
    if (a != 0) {
      res = dfs(l, i + 1, a + l[i], b, c, A, B, C, current + 10);
    } else {
      res = dfs(l, i + 1, a + l[i], b, c, A, B, C, current);
    }
    if (b != 0) {
      res = min(res, dfs(l, i + 1, a, b + l[i], c, A, B, C, current + 10));
    } else {
      res = min(res, dfs(l, i + 1, a, b + l[i], c, A, B, C, current));
    }
    if (c != 0) {
      res = min(res, dfs(l, i + 1, a, b, c + l[i], A, B, C, current + 10));
    } else {
      res = min(res, dfs(l, i + 1, a, b, c + l[i], A, B, C, current));
    }
  }
  return res;
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int ans;
  ans = dfs(l, 0, 0, 0, 0, a, b, c, 0);
  cout << ans << endl;
  return 0;
}
