import math
a = input()
b = input()
c = input()
d = input()
e = input()
min_l = min(l)
p = [ a,b,c,d,e ]
o = []
len_p = len(p)
tmp_p = ''
for i in range(0, len_p):
  if p[i][-1] == min_l:
    tmp_p = int(p.pop(i))
    print(i)
    break
new_p = 0
for i in p:
  new_p += math.ceil(int(i)/10)*10
print(new_p+tmp_p)