Input: = ,
   =
Output:
(1) ;
(2)
(3) For from downto 0 do
(3.1) ;
(3.2) c = , ;
(3.3) ;
(4) Return ( ).
Algorithm 3: Ciet and Joye's algorithm.