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

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

time = 0

for i in ae:
    if i % 10 == 0:
        time += i

ae = [i for i in ae if i % 10 != 0]

idx = 0
for i in ae:
    time += i
    time += 10 - (i % 10)

one = []
for i in ae:
    i = [j for j in str(i)]
    one.append(int(i[-1]))

print(time-10+min(one))
