a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

S = [a, b, c, d, e]
R = [a%10, b%10, c%10, d%10, e%10]
C = []
for i in R:
  if i > 0:
    C.append(i)
    
min = S[R.index(min(C))]

sum = 0
for i in S:
  sum += -(-i//10)*10
  
print(sum - (-(-min//10)*10) + min)