#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pdd pair<ld, ld> 
#define mp make_pair
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;
int n, a, b, c;
ll solve(ll l[], int i, int a1, int b1, int c1){
    if(i == n){
        if(a1 == 0 && b1 == 0 && c1 == 0)
        return INT_MAX;
        return abs(a-a1) + abs(b-b1) + abs(c-c1);
    }
    int ans = solve(l, i + 1, a1, b1, c1);
    ans = min(ans , (a1?10:0) + solve(l, i + 1, a1 + l[i], b1, c1));
    ans = min(ans , (b1?10:0) + solve(l, i + 1, a1, b1 + l[i], c1));
    ans = min(ans , (c1?10:0) + solve(l, i + 1, a1, b1, c1 + l[i]));
    return ans;
}
int main(){
    FASTIO
    cin >> n >> a >> b >> c;
    ll l[n];
    rep(i, 0, n)
    cin >> l[i];
    cout << solve(l, 0, 0, 0, 0);
    return 0;
}