a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

memo = [a,b,c,d,e]


m = 10
cnt = 0
for i in memo:
    if i % 10 == 0:
        cnt += int(i/10)
    else:
        cnt += int(i/10)+1

    if i%10 < m:
        m = i%10

print(cnt*10-(10-m))