import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

tmp = -10
li = [a,b,c,d,e]
for i in li:
  tmp += math.ceil(i/10)*10
li_1 = [a%10,b%10,c%10,d%10,e%10]
for i in range(5):
  try:
    li_1.remove(0)
  except:
    break
print(int(tmp + min(li_1)))