N = sorted([(input())for i in range(5)],key=lambda x:x[-1])
S = list(map(int,N))
print(S)
#合計時間
num = 0
key = 0
for x in S:
  if x % 10 == 0:
    num += x
  elif key == 0 and x % 10 != 0:
    num += x 
    key = 1
  else:
    num += x + 10 - int(str(x)[-1])
print(num) 