a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=0
amari=[a%10,b%10,c%10,d%10,e%10]
nokori=list((10-amari[i])%10 for i in range(5))
maxi=max(nokori)
dish=[a,b,c,d,e]
for i in range(5):
  if dish[i]%10==0:
    s=s+dish[i]
  else:
    s=s+dish[i]+10-dish[i]%10
if maxi==0:
  print(s)
else:
  print(s-10+maxi)
