## Problem Description and Formulation

The toy company wants to purchase commercial spots on cartoons and kids-movies to reach young boys and girls. The goal is to minimize the cost while ensuring that the commercials are seen by at least 30 million young boys and 40 million young girls.

Let's define the decision variables:

* $x$: the number of commercials during cartoons
* $y$: the number of commercials during kids-movies

The objective function is to minimize the total cost:

* Cost of cartoons: $5000$x
* Cost of kids-movies: $12000$y
* Total cost: $5000$x + $12000$y

The constraints are:

* The number of young boys reached: $2x + 4y \geq 30$
* The number of young girls reached: $x + 6y \geq 40$
* The number of commercials cannot be negative: $x \geq 0, y \geq 0$

## Gurobi Code

```python
import gurobi

# Create a new model
model = gurobi.Model()

# Define the decision variables
x = model.addVar(lb=0, name="cartoon_commercials")
y = model.addVar(lb=0, name="kids_movie_commercials")

# Define the objective function
model.setObjective(5000*x + 12000*y, gurobi.GRB.MINIMIZE)

# Define the constraints
model.addConstr(2*x + 4*y >= 30, name="young_boys_constraint")
model.addConstr(x + 6*y >= 40, name="young_girls_constraint")

# Optimize the model
model.optimize()

# Print the solution
if model.status == gurobi.GRB.OPTIMAL:
    print("Optimal solution found.")
    print(f"Number of cartoon commercials: {x.varValue}")
    print(f"Number of kids-movie commercials: {y.varValue}")
    print(f"Total cost: ${model.objVal:.2f}")
else:
    print("No optimal solution found.")
```

This code defines the optimization problem using Gurobi's Python interface, solves the problem, and prints the optimal solution if one is found. The solution will indicate the number of commercials to purchase during cartoons and kids-movies to minimize the cost while meeting the requirements.