PROGRAM ATCODER

implicit none
integer(16) :: n, a, b, c, i, j, s, cost, lena, lenb, lenc
integer(16),allocatable :: l(:,:),ans(:)

read(*,*) n, a, b, c
allocate(l(n,2), ans(4**n-1))
l = 0
ans = 10**9

do i = 1, n
	read(*,*) l(i,1)
end do

do j = 1, 4**n-1
	s = j
    cost = 0
    lenA = 0
    lenB = 0
    lenC = 0
	do i = 1, n
    	if (s /= 0) then
    		l(i,2) = mod(s,4)
        	s = s/4
        else
        	l(i,2) = 0
            exit
        end if
	end do
	do i = 1, n
		if (l(i,2) == 1) then
    		cost = cost + 10
        	lenA = lenA + l(i,1)
    	else if (l(i,2) == 2) then
    		cost = cost + 10
        	lenB = lenB + l(i,1)
    	else if (l(i,2) == 3) then
    		cost = cost + 10
        	lenC = lenC + l(i,1)            
		end if
    end do
    if(lenA /= 0 .and. lenB /= 0 .and. lenC /= 0)then
    	cost = cost + abs(a-lenA) + abs(b-lenB) + abs(c-lenC) - 30
        ans(j) = cost
    end if
end do

write(*,'(i0)') minval(ans)

END PROGRAM ATCODER