A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)

x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))

print(sum(sample_list)+sum(x)-max(x))
              