A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

data = [A,B,C,D,E]

X = 9
for i in range(4):
  if (data[i] % 10) <= X & (data[i] % 10) != 0:
    data.append(data[i])
    X = (data[i] % 10)
    del data[i]
  
#print(data)
sum = 0
for i in range(3):
  if (data[i] % 10) == 0:
    sum += data[i]
  else:
    sa = 10 - (data[i] % 10)
    sum += (data[i] + sa)
sum += data[4]

print(sum)
    
    