var
	n,a,b,c,s,x:Longint;
	i,j,k:byte;
	d:array[0..255]of Longint;
begin
	read(n,a,b,c);
	i:=0;
	for k:=1 to n do begin
		read(x);
		for j:=0 to i do begin
			d[j+i+1]:=d[j]+x;
		end;
		inc(i,i+1);
	end;
	s:=5000000;
	d[0]:=50000000;
	for j:=0 to i do for k:=0 to i do begin
		x:=abs(d[j and k]-a)+abs(d[j and not k]-b)+abs(d[k and not j]-c)+popcnt(j or k)*10-30;
		if s>x then s:=x;
	end;
	writeln(s);
end.