The Wizard’s Curse: Puzzle 4 Answer

Answer: 517943

The steps to get there are shown below.