All right, I know what I did wrong. When A sits on the side that has 2 seats, he can sit in 2 different positions, giving 2 for him, 4 for B and 4! for everyone else (8x4!). Similarly, when A sits on the side with 4, he can sit in four seats, B in 2 and the rest in 4!. Thus the total is 8x4!x2 or 384.