import sys
input=sys.stdin.readline

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

m = 9999
for i in s:
    t = i
    for j in s:
        if i != j:
            t += j if j%10 == 0 else j + 10-j%10
    m = min(m, t) 

print(m)
