Start D37 at zero. Start the FROM in the FOR at 1. In the MATH change D1 to D37
Try small sections of code in the simulator.