import math
a = [int(input()) for i in range(5)]
sum = 0
r =[]
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r.append(a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+min(r))