min_ = 9
ans = 0

for _ in range(5):
    t = int(input())
    a = t // 10
    b = t % 10
    if b == 0:
        ans += a * 10
    else:
        ans += (a + 1) * 10
        min_ = min(min_, b)

print(ans - 10 + min_)