a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = 0
lst = [a,b,c,d,e]
lst2 = []
for i in lst:
  if i%10 == 0:
    lst2.append(10)
  else:
    lst2.append(i%10)
print(lst2)
print(lst2.index(min(lst2)))
y = lst[lst2.index(min(lst2))]
del lst[lst2.index(min(lst2))]
for i in lst:
  if i%10 == 0:
    x += i
  else:
    x += (i//10+1)*10
x = x + y
print(x)