var u,r:word;begin read(u);repeat u:=u+r+2*u*r;writeln(u);r:=1and u;shr(u,1-r)until u=r end.