// C. Synthetic Kadomatsu - C++.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <numeric>



using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define ALL(x) x.begin(), x.end()

template <class T>
void chmin(T& ans, const T& b)
{
	if (ans > b) {
		ans = b;
	}
}

constexpr int BIG = std::numeric_limits<int>::max();

int dfs(const int N, const vec& L, int nowIdx, const int A, const int B, const int C, int a, int b, int c, int nowcost)
{
	if (N == nowIdx) {
		if (min(a, b, c) == 0) return BIG;
		else return abs(A - a) + abs(B - b) + abs(C - c) + nowcost - 30;
	}

	int ans = BIG;
	chmin(ans, dfs(N, L, nowIdx + 1, A, B, C, a, b, c, nowcost));
	chmin(ans, dfs(N, L, nowIdx + 1, A, B, C, a+L[nowIdx], b, c, nowcost+10));
	chmin(ans, dfs(N, L, nowIdx + 1, A, B, C, a, b+L[nowIdx], c, nowcost+10));
	chmin(ans, dfs(N, L, nowIdx + 1, A, B, C, a, b, c+L[nowIdx], nowcost+10));
	return ans;
}

int main()
{
	lolo N, A, B, C;
	cin >> N >> A >> B >> C;
	vec L(N);
	FOR(i, N) cin >> L[i];
	cout << dfs(N, L, 0, A, B, C, 0, 0, 0, 0) << endl;
}
