import math

F = []
for i in range(5):
    F.append(int(input()))
# print(F)
x = F[0] % 10
xi = 0
for i, fi in enumerate(F):
    y = fi % 10
    if y < x:
        x = y
        xi = i

ans = 0
for i, fi in enumerate(F):
    if i == xi:
        continue
    # ans += math.ceil(fi)
    ans += (math.ceil(fi / 10)) * 10

ans += F[xi]
print(ans)
