#abc123b

l,ll,m=[],[],[]
for i in xrange(5):
 l.append(int(raw_input()))
for i in xrange(5):
 m.append(l[i]%10)
s=130
idx=0
for i in xrange(5):
 if m[i]!=0:
  if m[i]<s:
   idx=i
   s=m[i]
for i in xrange(5):
 ll.append((l[i]+9)//10*10)
print sum(ll)-ll[idx]+l[idx]
