#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<deque>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

using namespace std;

#define vvint(vec,n,m,l) vector<vector<int>> vec(n,vector<int>(m,l));
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>;
#define pint pair<int,int>;
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")
#define ret return 0

int n, a, b, c;

int search(int used, int a_, int b_, int c_,vector<int> v)
{
	if (used == n)
	{
		if (min(min(a,b),c) > 0)
			return (abs(a - a_) + abs(b - b_) + abs(c - c_) - 30);
		else
			return INF;
	}
	int ans1 = search(used + 1, a_, b_, c_);
	int ans2 = search(used + 1, a_ + v[used], b_, c_)+10;
	int ans3 = search(used + 1, a_, b_ + v[used], c_)+10;
	int ans4 = search(used + 1, a_, b_, c_ + v[used])+10;

	return min(min(ans1,ans2),min(ans3,ans4));
}

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

	cin >> n >> a >> b >> c;

	vector<int> l(n);

	rep(i, n)
	{
		cin >> l[i];
	}

	int ans = search(0, 0, 0, 0,l);
	cout << ans << endl;

	ret;
}