The total displacement is
d=√((n-s)^2+(e-w)^2 ),
where n,s,e,w – total distances that car was driven northward, southward, eastward, westward respectively. Thus, in our situation,
d=√((0-0)^2+(5-0)^2 )=5 km.