There seems to be some error in the equation. The car first accelerates with 5 ms-2 then it accelerates with constant velocity. It should have been, then it continues with constant velocity.
So, the car moves from rest with acceleration 5 ms-2 for 8 s.
Distance travelled in this time is, S1 = ut + ½ at2
=> S1 = 0 + ½ × 5 × 82
=> S1 = 160 m
The velocity it attains in this 8 s is,
v = u + at
=> v = 0 + 5 × 8 = 40 m/s
So, distance travelled with this velocity for another 4 s (12-8 = 4) is, S2 = 40 × 4 = 160 m
So, the total distance travelled by the car is = S1 + S2 = 160 + 160 = 320 m