start with X set A = 1-Xi set B = 0 while Re(X): door 1: X-=A door 2: A-=A+A+A door 3: signflip A