A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
mod = 10
_sum = 0
flag = False
for a in (A,B, C, D, E):
    if a % 10 == 0:
        _sum += a
    else:
        flag = True
        _sum += (a + 10) - (a % 10)
        if a % 10 < mod:
            mod = a % 10
if not flag:
    mod = 0
print(_sum - 10 + mod)