He doesn't have to be worth 4.5 or 5 WAR per season. $25 mill is around 3 WAR. So let's say he manages 4 the first year, 3 the second, and only 2 the third, it's a breakeven deal overall.
Longo, OTOH, is due more than 7 WAR in salary, and you would have to be wildly optimistic to believe he can manage even 5. Around 3 (all three years combined) is far more likely.