array = [int(input()) for i in range(5)]
array2 = [] # 繰り上げの値
array3 = []#一の位

for i in array:
  array2.append((i//10 + 1 ) if i%10 != 0 else i//10 * 10)
  array3.append(i%10 if i%10 != 0 else 10)

print(sum(array2)-(10-min(array3)))