unittest
{
	assert( [ "5 100 90 80", "98", "40", "30", "21", "80" ].solve == 23 );
	assert( [ "8 100 90 80", "100", "100", "90", "90", "90", "80", "80", "80" ].solve == 0 );
	assert( [ "8 1000 800 100", "300", "333", "400", "444", "500", "555", "600", "666" ].solve == 243 );
}



import core.bitop;
import std.algorithm;
import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto a = 0L;
	auto b = 0L;
	auto c = 0L;
	input.front.formattedRead!"%s %s %s %s"( n, a, b, c );
	auto ls = new long[ n ];
	foreach( ref l; ls )
	{
		input.popFront;
		l = input.front.to!( long );
	}
	
	// 竹を合成したときの長さを計算
	auto ts = new long[ 1L << n ];
	foreach( i, ref t; ts )
	{
		foreach( j; 0L .. n )
		{
			if( i & ( 1L << j ) ) t += ls[ j ];
		}
	}
	
	// dp[ i本数 ][ 使った竹のbit集合 ] = 消費MP
	auto dp = new long[][]( 1 + 3, 1L << n );
	foreach( ref dpp; dp ) dpp[] = long.max;
	dp[ 0 ][ 0 ] = 0;
	foreach( i, x; [ a, b, c ] )
	{
		foreach( j; 0L .. dp[ i ].length.signed )
		{
			if( dp[ i ][ j ] == long.max ) continue;
			foreach( k; 1L .. dp[ i ].length.signed )
			{
				if( j & k ) continue;
				
				auto m = 10 * ( k._popcnt - 1 ) + abs( x - ts[ k ] );
				dp[ i + 1 ][ j | k ] = min( dp[ i + 1 ][ j | k ], dp[ i ][ j ] + m );
			}
		}
	}
	return dp[ $ - 1 ].reduce!min;
}
