# https://atcoder.jp/contests/abc123/tasks/abc123_b


A = gets.to_i
B = gets.to_i
C = gets.to_i
D = gets.to_i
E = gets.to_i

vs = [A, B, C, D, E];

ans = 0
last = [10, -1]
vs.each do |v|
  q, r = (v + 9).divmod(10)
  add = q * 10
  if r < last[0]
    last = [r, add - v]
  end
  ans += add
end
ans = ans - last[1]

puts ans
