def f(minutes, first = true)
  if minutes.size == 1
    return [(minutes[0] * 0.1).ceil * 10]
  else
    result = []
    minutes.each.with_index { |m, i|
      a = minutes.dup
      m = a.delete_at(i)
      result << f(a, false).map { |x|
        r = if first then (x + m) else ((x + m) * 0.1).ceil * 10 end
        r
      }
    }
    return result.flatten
  end
end

cooking_minutes = STDIN.read.split(/\s+/).map(&:to_i)
puts f(cooking_minutes).min