N,A,B,C=map(int,input().split())

l=[int(input()) for i in range(N)]

INF=3000

def mp(c,a,b,c):
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF

    ret0=mp(c+1,a,b,c)
    ret1=mp(c+1,a+1,b,c)+10
    ret2=mp(c+1,a,b+1,c)+10
    ret3=mp(c+1,a,b,c+1)+10

    return min(ret0,ret1,ret2,ret3)

print(mp(0,0,0,0))
