Counter target spell. At the beginning of your next first main phase, add X mana in any combination of colors, where X is that spell's mana value.
If the countered spell had {X} in its mana cost, include the value chosen for that X when determining how much mana to produce. For example, if you counter a spell that costs {X}{R} with X equal to 5, you'll produce six mana.
Your precombat main phase is the main phase that happens immediately after your draw step, not any other main phase.