a=list()
for i in range(5):
  a.append(int(input()))
max=10
count=0
for i in range(5):
  if a[i]%10<max and a[i]%10!=0:
    max=a[i]%10
    maxI=i
for i in range(5):
  if i!=maxI:
    count+=a[i]
    if a[i]%10!=0:
      count+=(10-a[i]%10)
count+=a[maxI]
print(count)