#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const long long INF = 1LL<<58;

int ncr(int n,int r){
    int ans=1;
    for (int i=1;i<n+1;i++){
        ans * =i;
    }
    for (int i=1;i<r+1;r++){
        ans / i;
    }
    return ans;
    
}

int main(){
    int a,b,c,n;
    cin >> a >>b >>c >> n;
    vector<int> l;
    l.resize(n);
    al.resize(n);
    bl.resize(n);
    cl.resize(n);
    for (int i=0;i<n;i++){
        cin>> l[i];
        al[i]=0;
        bl[i]=0;
        cl[i]=0;
    }
    
    for (int i=1;i<n-1;i++){
        for (int j=1;j<n-i;j++){
            int k = n - i - j;
            int tmp1,tmp2,tmp3;
            for (int x=0;x<ncr(n, i) ;x++){
                int code=x;
                int w;
                int last=0;
                int nokori = i;
                
                while(nokori!=0){
                    w = n - last - nokori +1;
                    index = code % w;
                    code = (code - index)%w;
                    w = w - index -1;
                    last = last + index;
                    al[last]=1;
                    nokori --;
                }

            }
            for (int x=0;x<(ncr(n-i, j) ;x++){
                int tmp=x;
                int w;
                int last=0;
                int nokori = j;
                
                while(nokori!=0){
                    w = n - i - last - nokori +1;
                    index = tmp % w;
                    tmp = (tmp - index)%w;
                    w = w - index -1;
                    last = last+index;
                    bl[last]=1;
                    nokori --;
                }                
                
            }
            update(al, bl, cl);
            va.resize(i);
            vb.resize(j);
            vc.resize(n-i-j);
            for (int t=0;t<n;t++){
                if (al[t]==1) va.push_back(l[t]);
                if (bl[t]==1) vb.push_back(l[t]);
                if (cl[t]==1) vc.push_back(l[t]);
            }
            
            int cost = 0;
            cost+= compute_lowest_cost(va, a);
            cost+= compute_lowest_cost(vb, b);
            cost+= compute_lowest_cost(vc, c);
            
            if (ans > cost) ans =cost;
            
            for (int t=0;t<n;t++){
                al[t]=0;
                bl[t]=0;
                cl[t]=0;
            }
        }
    }
    cout<< ans << endl;
    
    return 0;
}


