#coding: utf-8
import numpy as np

N, A, B, C = map(int, input().split())
bumboo = np.array([int(input()) for _ in range(N)])
magic = 0
for i in [A, B, C]:
    bumboo_diff = bumboo - i
    bumboo_diff = np.where(bumboo_diff >= 0)
    if np.sum(bumboo_diff) >= 2:
        magic += 10
    else:
        magic += np.min(bumboo_diff)
print(magic)