Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) used to say: "When the imam says the salam, turn away in whichever direction your need lies, right or left, and do not turn fully around like a donkey."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9303