A = [0]*5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
last = -1
mini = 9
for i in range(5):
  if mini > A[i] % 10 and A[i]%10 != 0:
    mini = A[i] % 10
    last = i
count = 0
for i in range(5):
  if i != last:
    count += (((A[i]-1) // 10) * 10)+10

print(count + A[last])