Write down the solution for this math problem: Solve 646 = -1378*p - 289*p + 40654 for p.
24