a=[int(input()) for i in range(5)]
m=a[0]%10
s=0
for i in range(1,5):
  if m > a[i]%10 and a[i]%10 != 0 or m == 0:
    m=a[i]%10
for i in range(5):
  if a[i]%10 == 0:
    s+=a[i]
  else:
    s+=a[i]-a[i]%10+10
s-=10-m
print(s)