#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

vector<int> l;
int ia,ib,ic;

int solve(int a,int b,int c,int index,int cost) {
  if(index == l.size())
    if(ia == a || ib == b || ic == c) return 112345678;
    else return abs(a) + abs(b) + abs(c) + cost;
  return min(solve(a-l[index], b, c, index + 1, cost + 10),
             solve(a, b-l[index], c, index + 1, cost + 10),
             solve(a, b, c-l[index], index + 1, cost + 10),
             solve(a, b, c, index + 1, cost + 10));
}

int main(void)
{
  int n;
  cin >> n >> ia >> ib >> ic;
  REP(i, n) {
    int x;
    cin >> x;
    l.push_back(l);
  }
  cout << solve(a,b,c,0,-30) << endl;
  return 0;
}
