A problem involving complex numbers in polar form

I'm having some problems with this question. It is as follows;

A and B are two points on a computer screen. A program produces a trace on the screen to execute the following algorithm.

Step 1 - Start at any point P on the screen.

Step 2 - From the current position describe a quarter circle about A.

Step 3 - From the current position describe a quarter circle about B.

Step 4 - Repeat step 2.

Step 5 - Repeat step 3, and stop.

Show that the trace ends where it began.

The section of my text book that this question is in deals with spiral enlargements of complex numbers but I am not sure how to do this question using them.

I have started by equating A to the origin. From here the point P may be described as . The point P' reached at the end of step 2 may be described as

From this is can be established that if then

It is after this that I don't know where to go next. It looks like if P is multiplied by s four times then the trace will arrive back at P but that doesn't seem to fit with describing quarter circles about B.

Any pointers would be appreciated!