na1 = []

for i1 in range(5):
    na1.append(int(input()))

r1 = 0
n1 = 0
for i1 in range(5):
    r1 += ((na1[i1] + 9) // 10) * 10
    if (na1[i1] % 10) != 0:
        if n1 == 0:
            n1 = na1[i1] % 10
        elif n1 > (na1[i1] % 10):
            n1 = na1[i1] % 10

r1 += n1 - 10
print(r1)