A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
cook_time = [A,B,C,D,E]
muda = [10-i%10 for i in cook_time]
cook_time_muda = list(zip(cook_time,muda))
cook_time_muda.sort(key=lambda x:x[1])
time = 0
for i in cook_time_muda:
    time = time + i[0]+i[1]
time = time - i[1]
print(time)