x = [int(input()) for i in range(5)]

def ceil(src, range):
    return ((int)(src / range) + 1 ) * range

x1 = [x[i] % 10for i in range(5)]
x2 = [ceil(x[i], 10) for i in range(5)]
x2[skip] = 0
result = sum(x2) + last