#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c;
long long ans = 1e18;
void solve(long long a1, long long b1, long long c1, vector<int> v,
           long long now) {
  if (a1 == a && b1 == b && c1 == c) {
    ans = min(ans, now);
    return;
  }
  if (a1 == 0) {
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] != -1) {
        long long tmp = v[i];
        v[i] = -1;
        solve(tmp, b1, c1, v, now);
        v[i] = tmp;
      }
    }
  }
  if (b1 == 0) {
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] != -1) {
        long long tmp = v[i];
        v[i] = -1;
        solve(a1, tmp, c1, v, now);
        v[i] = tmp;
      }
    }
  }
  if (c1 == 0) {
    for (int i = 0; i < v.size(); ++i) {
      if (v[i] != -1) {
        long long tmp = v[i];
        v[i] = -1;
        solve(a1, b1, tmp, v, now);
        v[i] = tmp;
      }
    }
  }
  if (a1 != 0 && a1 != a) {
    if (a1 > a)
      solve(a, b1, c1, v, now + a1 - a);
    else {
      solve(a, b1, c1, v, now + a - a1);
      for (int i = 0; i < v.size(); ++i) {
        if (v[i] != -1) {
          long long tmp = v[i];
          v[i] = -1;
          solve(a1 + tmp, b1, c1, v, now + 10);
          v[i] = tmp;
        }
      }
    }
  }
  if (b1 != 0 && b1 != b) {
    if (b1 > b)
      solve(a1, b, c1, v, now + b1 - b);
    else {
      solve(a1, b, c1, v, now + b - b1);
      for (int i = 0; i < v.size(); ++i) {
        if (v[i] != -1) {
          long long tmp = v[i];
          v[i] = -1;
          solve(a1, b1 + tmp, c1, v, now + 10);
          v[i] = tmp;
        }
      }
    }
  }
  if (c1 != 0 && c1 != c) {
    if (c1 > c)
      solve(a1, b1, c, v, now + c1 - c);
    else {
      solve(a1, b1, c, v, now + c - c1);
      for (int i = 0; i < v.size(); ++i) {
        if (v[i] != -1) {
          long long tmp = v[i];
          v[i] = -1;
          solve(a1, b1, c1 + tmp, v, now + 10);
          v[i] = tmp;
        }
      }
    }
  }
}
int main() {
  cin >> n >> a >> b >> c;
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  solve(0, 0, 0, v, 0);
  return cout << ans << "\n", 0;
}
