In a week full of risky trades, the Rams showed hedge fund managers how to get out of a bad deal: attach a first-round pick.

The Rams and the Lions pulled off the biggest NFL trade in years on Saturday night when Los Angeles sent Jared Goff, two first-round picks, and a third to Detroit for Matthew Stafford. Both teams helped solve a lot of each other’s problems, at least on paper: Sean McVay gets a quarterback with a higher ceiling in his offense; Detroit receives picks to help kick-start its rebuild; Stafford gets to play for the best offensive coach he’s ever worked with; and the Rams found a home for Jared Goff’s contract, which still has over $100 million left on it, with over $40 million guaranteed. The deal is, in theory, a win-win for everyone except perhaps Goff, who leaves one of the best offensive minds in football for a rebuilding team in cold weather, though as a consolation prize, he still gets to keep the $27 million in salary owed to him in 2021. The Rams have a better quarterback now than they had on Friday. The entire NFC is riding on whether it cost too much to acquire him and whether the Rams strategy of betting big on every season ends with them eventually holding the bag.

Conventional wisdom holds that McVay’s offense has been held back by an average quarterback and Stafford has been held back by an average franchise. If so, McVay and Stafford not only deserve each other but will thrive together. “What would happen if he had a Sean McVay or a Sean Payton?” Stafford’s former teammate and current ESPN analyst Dan Orlovsky told me in my September 2019 profile of Stafford. Those questions never have to be asked again.

Did the Rams or Lions win the trade? Yes.

When I asked Stafford about his ideal offense, he mentioned Kansas City, where the Chiefs operate with a mix of deep shots and swing routes out of the backfield. He wanted “a healthy mix” of both. Goff did not make McVay’s life easier. Stafford will—he’ll be able to add a deeper passing element to McVay’s offense. He’s not a top-five quarterback, but he’s worlds better than Goff, and if the Rams believe the difference between the divisional round and the Super Bowl is the difference between Goff and Stafford, this trade was the only way forward. The Rams did not overpay when you consider the entire deal: They essentially had to pay one first- and one third-round pick for Stafford, and then another first to get out of Goff’s contract. This was a quarterback upgrade with a salary dump done on the side. The Rams inherit the two years and $43 million left on Stafford’s deal, including $22 million in dead cap money next season. The Lions will take a $17.8 million dead cap charge for Stafford.