A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
sub = 10 - min([i%10 for i in l if i%10!==0])
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)