a=[]
for i in range(5):
  a.append(input())
b=[]
for j in range(5):
  if a[j]%10==0:
    b.append(10)
  else:
    b.append(a[j]%10)
idx=b.index(min(b))
cnt=a[idx]
del a[idx]
for k in range(4):
  if a[k]%10==0:
    cnt+=a[k]
  else:
    cnt+=a[k]+10-(a[k]%10)
print(cnt)
  


