data = []
for i in range(5):
  data.append(int(input()))

ans = 0
c = 0

# 先にdivmod(data[c], 10)[1] == 0 をansに追加しちゃう
for zero_c in range(len(data)):
  if divmod(data[zero_c], 10)[1] == 0:
    ans += data[zero_c]
    data[zero_c] = 0

# print("ans:", ans)
# print("data:", data)

while data != [0, 0, 0, 0, 0]:
  if data.count(0) == 4:
    ans += data[c]
    data[c] = 0
    c += 1
  else:
    for i in range(9, 0, -1):
      if divmod(data[c], 10)[1] == i:
        ans += data[c] + (10 - i)
        data[c] = 0
    c += 1

# print("ans:", ans)
# print("data:", data)
print(ans)
