A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ALL = [A,B,C,D,E]
G=[[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(len(ALL)):
  G[i][1] = ALL[i]
  G[i][0] = 10-(ALL[i] %10)
G.sort()
total = 0
for j in range(4):
  total = total+G[j][1]+G[j][0]
total = total + G[4][1]
print(total)
  