| {\bf 0} \rangle | l_2 \rangle   \cdots | h_N \rangle | l_N
\rangle
      | h_1  0 \cdots 0 h_2\rangle_{\rm tape} \otimes \nonumber \\
& & | l_1 \rangle_{\rm total~length} \nonumber \\
& \stackrel{\rm shift}{\longrightarrow} & | {\bf 0} \rangle | l_1
\rangle
      | {\bf 0} \rangle | l_2 \rangle   \cdots | h_N \rangle  | l_N
\rangle | h_1 h_2 0 \cdots 0 \rangle_{\rm tape} \otimes \nonumber \\
& & | l_1 \rangle_{\rm total~length} \nonumber \\
& \stackrel{\rm add}{\longrightarrow} & | {\bf 0} \rangle | l_1 \rangle
      | {\bf 0} \rangle | l_2 \rangle   \cdots | h_N \rangle  | l_N
\rangle | h_1 h_2 0 \cdots 0 \rangle_{\rm tape} \otimes \nonumber \\
& & | l_1+l_2  \rangle_{\rm total~length} \nonumber \\
&\cdots &
\nonumber \\
&\stackrel{\rm shift}{\longrightarrow} & | {\bf 0} \rangle  | l_1
\rangle
      | {\bf 0} \rangle  | l_2 \rangle  \cdots | {\bf 0} \rangle  | l_N
\rangle | h_1 h_2 \cdots h_N 0  \cdots 0 \rangle_{\rm
tape}  \otimes \nonumber \\
& & | l_1+\cdots+l_{N-1}  \rangle_{\rm total~length} \nonumber \\
&\stackrel{\rm add}{\longrightarrow} & | {\bf 0} \rangle  | l_1 \rangle
      | {\bf 0} \rangle  | l_2 \rangle  \cdots | {\bf 0} \rangle  | l_N
\rangle | h_1 h_2 \cdots h_N 