In order to calculate the distance traveled before changing directions, first let's calculate the acceleration using the second law of Newton (let's use a negative force, since it's opposite to the movement):
[tex]\begin{gathered} F=m\cdot a \\ -100=5\cdot a \\ a=-\frac{100}{5}=-20\text{ m/s2} \end{gathered}[/tex]Then, we can calculate the distance traveled using Torricelli's equation:
[tex]\begin{gathered} V^2=V^2_0+2\cdot a\cdot d \\ 0=500^2+2\cdot(-20)\cdot d \\ -40d+250000=0 \\ 40d=250000 \\ d=6250\text{ m} \end{gathered}[/tex]Therefore the particle travels 6250 meters before changing the movement direction.