x = [int(input()) for i in range(5)]
a=[]
for i in x:
  a.append(i%10)
while 0 in a:
  a.remove(0)
b=sorted(a)
y=0
for i in x:
  if i%10==0:
    y+=i
  else:
    y+=(i+(10-(i%10)))
print(y-(10-b[0]))
