Three-dimensional simulations of the solar wind interaction with Mars