a = []
b = []

for i in range(5):
    In = int(input())
    a.append(int(In/10))
    b.append(In%10)

b_notzero = [i for i in b if i != 0]
if len(b_notzero) != 0:
    b_notzero.sort()
    b_min = b_notzero[0]
    print(sum(a) * 10 + (len(b_notzero) - 1) * 10 + b_min)
else:
    b_min = 0
    print(sum(a))