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

a_s = a + (10 - a%10)
a_a = a%10
b_s = b + (10 - b%10)
b_a = b%10
c_s = c + (10 - c%10)
c_a = c%10
d_s = d + (10 - d%10)
d_a = d%10
e_s = e + (10 - e%10)
e_a = e%10

answer = (a_s + b_s + c_s + d_s + e_s)

List =[]
List.append(a_a)
List.append(b_a)
List.append(c_a)
List.append(d_a)
List.append(e_a)
List.sort()

for i in range(5):
    if(List[i] != 0):
        answer = answer - (10-List[i])
        break

print(answer)