a = []
a[0] = gets.to_i
a[1] = gets.to_i
a[2] = gets.to_i
a[3] = gets.to_i
a[4] = gets.to_i

mi = 0
a.each_with_index { |v,i|
  x = v % 10
  if x > 0 and x < a[mi] % 10
    mi = i
  end
}

def dceil(x,y)
  return (x+y-1)/y
end

s = 0
a.each_with_index { |v,i|
  if i != mi
    s += dceil(v, 10) * 10
  end
}


puts s + a[mi]
