Cardinals beat Padres 4-3, end 4-game slump