Not great at Physics, but I'll give it a shot
vf^2 = vi^2 + 2ad
vi = initial velocity = 0....so we have
(50m/s)^2 = 0 + 2 (4m/s^2) * d
2500m^2 / s^2 = 8 m/s^2 * d divide both sides by 8m/s^2
[2500m^2/ s*2] / [ 8m /s^2] = d = 312.5 m ......correct !!!
Second one
vi = 20m/s
vf = 0 [ we are stopped at the end ]
a = -5m/s^2 [ we are slowing down ]
So
0 = [20m/s]^2 + 2(-5m/s^2) * d
0 = 400m^2 / s^2 - 10 m/s^2 * d multiply through by s^2
0 = 400m^2 - 10m * d
10m * d = 400m^2 divide both sides by 10m
d = 400m^2 / 10m = 40 m = stopping distance