#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	unsigned size_; 
	std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	//unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	unsigned root(unsigned x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/
int N, A, B, C;

ll dfs(int cur, ll a, ll b, ll c, int l[])
{
	if (cur == N)
	{
		if (a>0 && (b > 0) && (c>0))
		{
			return abs(a-A) + abs(b-B) + abs(c-C) - 30;
		}
		else return INT_MAX;
	}
	ll ret0 = dfs(cur+1, a, b, c, l);

	ll ret1 = dfs(cur+1, a+l[cur], b, c, l) + 10;
	ll ret2 = dfs(cur+1, a, b+l[cur], c, l) + 10;
	ll ret3 = dfs(cur+1, a, b, c+l[cur], l) + 10;

	ll ret = min(ret0, ret1);
	ret = min(ret, ret2);
	ret = min(ret, ret3);
	return ret;
}

int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	
	cin >> N >> A >> B >> C;
	//cout << N << endl;
	
	int l[N];
	rep(i, N)
	{
		cin >> l[i];
	}
	
	/*
	ll min_c = INT_MAX;

	for ( int i = 0; i < (1 << 9) - 1; i++)
	{
		ll total = 0;
		for(int j = 0; j < i; j++)
		{
			ll sum = 0;
			int count = 0;
			ll tmp = j;
			int idx = 0;
			while(tmp)
			{
				if (tmp & 1) 
				{
					sum += l[idx];
					count += 10;
				}
				tmp = tmp >> 1;
				idx++;
			}

			count += abs(A - sum);

			for(int k = 0; k < i; k++)
			{
				if (j&k)
				{
					continue;
				}
				ll ksum = 0;
				int kcount = 0;
				ll ktmp = k;
				int kidx = 0;
				while(ktmp)
				{
					if (ktmp & 1) 
					{
						ksum += l[kidx];
						kcount += 10;
					}
					ktmp = ktmp >> 1;
					kidx++;
				}

				kcount += abs(B - ksum);
				for(int m = 0; m < i; m++)
				{
					if ((j&m) || (k&m))
					{
						continue;
					}
					ll msum = 0;
					int mcount = 0;
					ll mtmp = m;
					int midx = 0;
					while(mtmp)
					{
						if (mtmp & 1) 
						{
							msum += l[midx];
							mcount += 10;
						}
						mtmp = mtmp >> 1;
						midx++;
					}

					mcount += abs(C - msum);
					total=count+mcount+kcount;
					min_c = min(min_c, total);
				}
			}

		}
	}
	cout << min_c << endl;
	*/

	cout << dfs(0,0,0,0,l) << endl;


	return 0;
}


Measured memory_bytes: 256