num = [int(input()) for _ in range(5)]

ans = 0
flag = 0
for i in num:
    if i % 10 == 0:
        ans += i
    else:
        ans += i // 10 * 10 + 10
        flag = 1

if flag:
    ma = 0
    for i in num:
        if i % 10 == 0:
            continue
        ma = max(ma, 10 - i % 10)

print(ans - ma)

