#include <bits/stdc++.h>
using namespace std;
int Ans = 2147483647;
int N, to[5];
int len[20];
inline int Rd() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline void CkMin(int &aa, int bb) {
  if (aa > bb) aa = bb;
  return;
}
inline int Abs(int x) { return x < 0 ? -x : x; }
int cnt[5];
int cho[20];
int haslen[5][20];
int dp[4][20][2000];
void Calc() {
  if (cnt[1] == 0 || cnt[2] == 0 || cnt[3] == 0) return;
  register int i, j, k;
  int res = 0, tpres;
  memset(dp, 0, sizeof dp), dp[1][0][0] = dp[2][0][0] = dp[3][0][0] = 1;
  cnt[1] = cnt[2] = cnt[3] = 0;
  for (i = 1; i <= N; ++i) haslen[cho[i]][++cnt[cho[i]]] = len[i];
  for (i = 1; i <= 3; ++i) {
    tpres = 2147483647;
    for (j = 1; j <= cnt[i]; ++j) {
      for (k = 2000; k >= haslen[i][j]; --k)
        if (dp[i][j - 1][k - haslen[i][j]]) {
          if (dp[i][j][k] == 0)
            dp[i][j][k] = dp[i][j - 1][k - haslen[i][j]] + 1;
          else
            CkMin(dp[i][j][k], dp[i][j - 1][k - haslen[i][j]] + 1);
          CkMin(tpres, (dp[i][j][k] - 2) * 10 + Abs(k - to[i]));
        }
    }
    res += tpres;
  }
  CkMin(Ans, res);
  return;
}
void Dfs(int Deep) {
  if (Deep > N) {
    Calc();
    return;
  }
  for (register int i = 1; i <= 3; ++i) {
    cho[Deep] = i, ++cnt[i];
    Dfs(Deep + 1);
    --cnt[i];
  }
  return;
}
int main() {
  register int i;
  N = Rd();
  to[1] = Rd(), to[2] = Rd(), to[3] = Rd();
  for (i = 1; i <= N; ++i) len[i] = Rd();
  Dfs(1);
  printf("%d\n", Ans);
  return 0;
}
