import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
li = [A, B, C, D, E]
temp = 9
idx = -1
for i in range(len(li)):
    if 0 != li[i] % 10 and temp > li[i] % 10:
        temp = li[i] % 10
        idx = i

result = 0
for i in range(len(li)):
    if idx == i:
        result += li[i]
    else:
        result += math.ceil(li[i] / 10) * 10
print(result)
