a=[]
for i in range(5):
  a.append(int(input()))

ans=0
s=a[0]%10
for i in range(1,5):
  if s>a[i]%10 and a[i]%10!=0:
    s=a[i]%10

for i in range(5):
  if a[i]%10 == 0:
    ans+=a[i]
  else:
    ans+= a[i]+(10-a[i]%10)

print(ans-10+s)