## 2 Preliminary
### Definitions and Notation  
This subsection introduces definitions, notation, and conventions. Let \(O\) be an operation in \(\{N,S,E,W\}\). We denote by \(O^{i}(\mathbf{v})\) the execution of \(i\) consecutive \(O\) operations on \(\mathbf{v}\), where \(\mathbf{v}\) is a row (respectively, column) of the board if \(O\in\{E,W\}\) (respectively, \(O\in\{N,S\}\)). We simply write \(O(\mathbf{v})\) as \(O^{1}(\mathbf{v})\). We call \(O^{i}(\cdot)\) for some \(i\) and \(O\in\{E,W\}\) (respectively, \(O\in\{N,S\}\)) a _row (respectively, column) operation_. It is easy to see that \(N^{i}(\cdot)\) (respectively, \(E^{i}(\cdot)\)) is the same action as \(S^{m-i}(\cdot)\) (respectively, \(W^{n-i}(\cdot)\)). In this paper, a _configuration_ means a placement of the pieces on the board. We will refer to the following configuration as _initial configuration_ and denote it by \(\mathbf{A}\): the piece numbered \((i-1)n+j\) is placed at the \(i\)th row and the \(j\)th column for each \(1\leq i\leq m\) and \(1\leq j\leq n\). There are two ways to refer a piece in a configuration. One is by its number and the other is by its position on the board: The piece having number \(r\) is referred to as \"the piece numbered \(r\)\", and the piece placed at the \(i\)th row and the \(j\)th column in a configuration is called \"the piece placed at \((i,j)\)\" in the configuration. Let \(\mathscr{M}_{m,n}\) denote the set of configurations of the \(m\) by \(n\) board (a configuration of the board can be considered as an \(m\) by \(n\) matrix in which the pieces are numbered bijectively from \(\{1,2,\ldots,mn\}\)). We say that _the board has a configuration_\(\mathbf{X}=(x_{i,j})\in\mathscr{M}_{m,n}\) if the piece placed at \((i,j)\) has number \(r\) iff \(x_{i,j}=r\) for each \(1\leq i\leq m\) and \(1\leq j\leq n\). The symbol \(\mathbf{r}_{k}\) (respectively, \(\mathbf{c}_{k}\)) is used to refer to the \(k\)th row (respectively, column). We say that _the piece numbered \(r\) is at its right position in \(\mathbf{X}\)_ if \(x_{p,q}=r\), where \(p=\lceil r/n\rceil\) and \(r\equiv q\pmod{n}\). For \(\mathbf{X}\), \(\mathbf{Y}\in\mathscr{M}_{m,n}\), we write \(\mathbf{X}\equiv_{\{N,S,E,W\}}\mathbf{Y}\), or simply \(\mathbf{X}\equiv\mathbf{Y}\), if \(\mathbf{Y}\) can be obtained from \(\mathbf{X}\) by performing a sequence of the basic operations \(\{N,S,E,W\}\). We thus also write \(\mathbf{X}\
ot\equiv_{\{N,S,E,W\}}\mathbf{Y}\), or simply \(\mathbf{X}\
ot\equiv\mathbf{Y}\), if there is no sequence \(\mathcal{S}\) of the basic operations such that \(\mathbf{Y}\) can be obtained from \(\mathbf{X}\) by applying \(\mathcal{S}\). Let \(\mathcal{S}=O_{1}^{k_{1}}(\cdot),O_{2}^{k_{2}}(\cdot),\ldots,O_{\ell}^{k_{ \ell}}(\cdot)\) be a sequence of the basic operations, where \(O_{j}\in\{N,S,E,W\}\) for \(1\leq j\leq\ell\) and we are assuming that \(O_{j}\
eq O_{j+1}\). The integer \(\ell\) and the value \(\sum_{i=1}^{\ell}k_{i}\) are referred to as _drag number_ and _push number_ of the sequence \(\mathcal{S}\), respectively. We denote the drag and push numbers of \(\mathcal{S}\) by \(dn(\mathcal{S})\) and \(pn(\mathcal{S})\), respectively. For configurations \(\mathbf{X}\) and \(\mathbf{Y}\), we denote the values \(\min_{\mathcal{S}}dn(\mathcal{S})\) and \(\min_{\mathcal{S}}pn(\mathcal{S})\) by \(dn(\mathbf{X},\mathbf{Y})\) and \(pn(\mathbf{X},\mathbf{Y})\), respectively, where both minimums are taken over all sequences deriving \(\mathbf{Y}\) from \(\mathbf{X}\). Specially, in the case where \(\mathbf{Y}\) is the initial configuration \(\mathbf{A}\), we simply write \(dn(\mathbf{X})\) and \(pn(\mathbf{X})\) instead of \(dn(\mathbf{X},\mathbf{A})\) and \(pn(\mathbf{X},\mathbf{A})\). The value \(dn(\mathbf{X})\) and \(pn(\mathbf{X})\) are both natural values to measure how far \(\mathbf{X}\) is from the initial configuration \(\mathbf{A}\). In a situation where the torus puzzle is implemented on a touch-panel device, it would be natural to consider a consecutive iterations of the same operation as a single step.