The rags-to-riches tale is a cultural archetype, but so is its reverse: the reminder to be careful what you wish for. Social science journals are full of cases of sweepstakes winners who wound up no happier in the end. Sometimes winning the lottery doesn’t work out so well for NBA teams, either.

The Portland Trail Blazers weren’t blessed by winning the prize of the first draft pick in 2007 and choosing Greg Oden. The Washington Wizards won the lottery and took Kwame Brown in 2001; had they stayed in their expected position, they might have gotten Pau Gasol instead.

That’s not to say that the 13 NBA teams that will vie for the first pick in Tuesday night’s draft lottery would be better off losing out. Drafting in the NBA isn’t quite as unpredictable as it is in the NFL. The first pick, in particular, produces a high rate of return. But the impact of winning the draft lottery is not quite as impressive as you might assume.

It’s tempting to go through something like the following thought process: The league’s superstar players, like LeBron James and Kevin Durant, are worth perhaps worth $40 million per season or more. Imagine having the chance to employ the next LeBron for a decade. That’s a $400-million player up for grabs based on the bounce of a few ping-pong balls!

Things rarely work out so smoothly, however, and there are three gigantic problems with this analysis. First, drafting is an imperfect science: Durant, for example, was the second pick in 2007, behind Oden. Second, even if a player produces a lot of value, you’re still going to pay him something. Third, the player may not stay around long enough to win his team a title: Instead, teams are guaranteed control of their first-round picks for only five years.

The difference between the Milwaukee Bucks winning the lottery Tuesday night (they have the best chance of doing so) and falling to the fourth pick probably amounts to the equivalent of around $11 million in long-term profits. That’s not chump change, but it’s World Series of Poker money — not Powerball dough.

The NBA draft lottery was instituted in 1985. I looked up how many wins (as measured by Basketball-Reference.com’s win shares) each player chosen in the first round since then produced during his first five NBA seasons, based on the slot where he was selected. The analysis accounts for the fact that the most recent selections, such as the New Orleans Pelicans’ Anthony Davis, have not yet seen five seasons.

The average number of wins produced by draft selections Nos. 1 through 30 appears in the graphic below. The pattern is fairly nonlinear: No. 1 overall picks have produced an average of 33.9 wins in the five seasons following their pick, as compared to 22.3 for No. 2 overall selections. It takes a logarithmic curve, with a fairly sharp uptick for the No. 1 overall pick, to do an adequate job of fitting past years’ results.

With a bit more work, we can translate wins into dollars. In particular, during the previous NBA regular season, a total of $1.78 billion was paid to players who weren’t still on rookie-scale contracts. Collectively, those players produced just over 1,000 win shares. That implies that the market rate for a win in the NBA is about $1.75 million.

The players on rookie-scale contracts were bargains by comparison, coming at a cost of about $900,000 per win last season. (For much more detail on how rookie contracts work, see Larry Coon’s salary cap FAQ.)

But how much does the price per win vary based on where a player was chosen in the draft?

The next chart compares the market value produced by the player against his rookie-scale contract figures, using the following assumptions. First, the market rate for an NBA player is increasing at 3.5 percent per year. Second, teams pick up their option for each first-round pick for the player’s third and fourth seasons (this assumption might seem dubious — we’ll test it in a moment), and they make the players a qualifying offer before his fifth seasons, which comes to represent his annual salary during that year. Third, the team is paying the player the maximum amount allowed under the rookie scale in the NBA’s collective bargaining agreement. Fourth, I’m using smoothed values for the wins produced by each pick based on our previous chart.

In this analysis, the first overall pick produces about $63 million worth of market value during the first five NBA seasons after he’s drafted; by comparison, under our assumptions, his team would be obligated to pay him $35 million over five years. That means a discount of about $28 million for the team.

The other first-round picks are also bargains by this measure, although the value diminishes the later a player goes in the draft. The fourth overall selection — the worst the Bucks could wind up with tonight — produces a profit of just under $18 million. The 30th and last pick in first round, held this year by the San Antonio Spurs, brings an expected profit of about $4 million.

As I mentioned, these figures assume that an NBA team will employ a drafted player for five seasons. However, NBA teams are obligated to keep first-round draft picks for only two years. They have the unilateral option to extend the contract for a third and fourth year, and then to make the player a qualifying offer for his fifth season. This potentially gives the teams some option value in that they can extend their more successful picks on reasonably favorable terms, while cutting bait on the weaker players.

To an extent, these options are more appealing in theory than in practice. One problem is that an NBA team must determine whether to offer a player his third- and fourth-year options a year ahead of time, or before he starts his second and third seasons. In practice, it’s quite rare for a team to fail to exercise its third-year option.

I attempted to simulate this decision-making process. I assumed that an NBA team made a projection of a player’s third-year value based on his win-shares total as a rookie and the draft slot where he was chosen. If the player’s rookie-scale contract salary was at least 20 percent higher than his projected value for his third season, I assumed that the team dropped him. However, these conditions only applied to about 2.5 percent of draft picks. (A player basically has to be a complete and utter disaster to get dropped: This algorithm would have the Cleveland Cavaliers failing to pick up their third-year option on Anthony Bennett, the first overall pick in last year’s draft, for instance.)

The fourth-year option represents more of a real choice. A team still has to decide on it a year in advance. But it has two years of player performance to evaluate, and not just one. Meanwhile, the player may be improving slowly — if he’s still improving at all — while he’s due for a hefty raise under the rookie pay scale. I assumed that teams would drop players whose fourth-year salaries were projected to be at least 10 percent higher than their value in that season, and found they would fail to extend 28 percent of players by these rules.

Finally, a team gets to decide after a player’s fourth season whether to make him a qualifying offer for his fifth season. Using a similar method, I found that about 32 percent of players who hadn’t been dropped after their third or fourth seasons would be let go at that point.

We can now re-run our estimates of the net value of each draft pick excluding both the win shares associated with the dropped players and the cost of their contracts. You’d expect this to increase the profitability associated with the picks, since the teams are dropping precisely those players they expect to produce a negative return on investment. It does increase the profitability, but the difference isn’t all that great — the net value associated with the average first-round draft pick improves by 18 percent. Most of the improvement in profitability comes from selections chosen late in the first round. That’s because they’re due for proportionately larger pay increases under the league’s rookie pay scale and should be dropped more often.

My revised estimates of the net profitability associated with each first-round draft pick are in the table below. To be clear, these are general estimates built from how all draft picks have performed since 1985, and don’t say anything in particular about Andrew Wiggins, or other projected top picks this year. For readability, figures are rounded to the nearest $50,000 increment.

The first overall draft pick is worth about $30 million by this measure, compared to $23.5 million for the second pick, $20.5 million for the third pick and $18.8 million for the fourth pick. The 14th selection — the last lottery pick — is worth about $12 million, while the final overall pick in the first round is worth $7.3 million.

But these figures only estimate the profit associated with a player during his first five seasons. What happens after that?

Usually teams aim to act proactively before getting to that point, especially for their most talented players. They’ll try to extend those players’ contracts.

These options become pretty complex. To go through a full empirical analysis of the profit or loss associated with these extensions and long-term deals would require an article with even more footnotes than this one. That may be a challenge that we’ll undertake in the future.

In the meantime, let’s try a slightly gentler approach. I looked up the players whose rookie seasons came 10 years ago (in the 2003-04 NBA season) or later and found who produced the most win shares over their first four NBA seasons. Did they turn out to produce happy endings for the teams who originally drafted them? Here are the top 15, in order:

Chris Paul (Hornets): Traded to the Clippers after he made clear to New Orleans that he wouldn’t sign an extension with them. LeBron James (Cavaliers): Took his talents to South Beach. Blake Griffin (Clippers): Signed through 2016-17. This could turn out happily, but it’s too early to say. Dwyane Wade (Heat): This has to be considered a big success based on what he and the Heat have accomplished so far, though going forward Wade may not be worth as much as he’s paid. Dwight Howard (Magic): Forced a trade to the Lakers. Kevin Durant (Sonics/Thunder): Extended through 2015-16. This has to count as a smashing success, even if the Thunder never win a title. Brandon Roy (Trail Blazers): Signed an extension with Portland, but the contract turned into a disaster after injuries robbed Roy of his game. The Blazers eventually used their amnesty provision on him. James Harden (Thunder): Preemptively traded to Houston, in part because the Thunder wanted to avoid a massive luxury tax bill. Al Horford (Hawks): Signed an extension — in what initially looked like a pretty good deal for Atlanta — but he’s since missed most of the 2011-12 and 2013-14 seasons with injuries. Chris Bosh (Raptors): Signed one extension and then to South Beach he took his talents. Kevin Love (Timberwolves): One more guaranteed year on his deal and then he reportedly wants out of Minnesota. Andre Iguodala (76ers): Now we’ve begun to reach those players who are fine NBAers, but probably worth something near the maximum NBA salary and not a lot more than that. Marc Gasol (Grizzlies): See above. Derrick Rose (Bulls): Signed an extension, which looked to have plenty of upside for the Bulls — but his injuries mean it could turn into a problem for them instead. Deron Williams (Jazz): Forced a trade out of Utah. His performance has regressed in Brooklyn and the trade is looking like a blessing in disguise for the Jazz.

Get the drift? These players produced a ton of surplus value for their teams during their first three or four or five seasons. Those rookie-scale contracts are really favorable to NBA teams.

However, we’ve already accounted for the profit a team achieves on a player over his first five seasons. And after that, things get much dicier. The attrition rate is high. Players can leave in free agency, or force a trade, or get hurt, or perform at a perfectly decent level but not necessarily any better than what they’re being paid. And this is a list we’ve formulated with the benefit of hindsight, knowing exactly how valuable the players were during their first four seasons.

After winning the draft lottery, a team essentially needs to get lucky three times over in order to have a storybook ending. First, it has to draft the right player. Next, it has to convince him to stay in town. Finally, he has to play up to his new contract. The odds are that something will go wrong. In 1997, the San Antonio Spurs chose Tim Duncan at No. 1 and went on to win four NBA titles with him on the roster. None of the teams to make the first overall pick since has won a championship.