- `p` : 이동하려는 칸의 개수 - `d` : 이동하려는 방향 - `N` : 배열의 크기 ```cpp int nx = (x + dx[d] * p + N * p) % N; int ny = (y + dy[d] * p + N * p) % N; ```