A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

arr = [A, B, C, D, E]
arr_s = sorted(set(list(map(lambda x: x%10, arr))))
if len(arr_s) == 1 or arr_s[0] != 0:
    mn = arr_s[0]
else:
    mn = arr_s[1]

b = 0
for a in arr:
    b += (a//10)*10
    if a%10 != 0:
        b += 10
ans = b - 10 + mn
print(ans)