from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
tmp = []
time = 0
for i in range(0,5):
    w = 0
    num = int(input())
    while True:
      if float.is_integer((num + w)/10):
        break
      w += 1
    tmp.append({"num":num, "weight":w})
tmp = sorted(tmp, key=lambda x:x['weight'])
for i in range(0,5):
    time += tmp[i]['num']
    if i < 4:
    	time = Decimal(time/10).quantize(Decimal('0'), rounding=ROUND_HALF_UP) * 10
print(time)