a=[]
for i in range(5):
  a.append(int(input()))
m={}
for i in range(5):
  if a[i]%10!=0:
    m[a[i]%10]=a[i]
target=m[min(m.keys())]
res=0
for i in range:
  if a[i]==target:
    res+=target
  else:
    res+=math.ceil(a[i]/1)
print(res)