pad A,B,S to length N in getM