1 if (N >= 1) {
2   for (int c1 = 1; c1 <= M; c1 += 1)
3     S1(1, c1);
4   for (int c0 = 2; c0 <= N; c0 += 1) {
5     for (int c1 = 1; c1 <= M; c1 += 1)
6       S2(c0 - 1, c1);
7     for (int c1 = 1; c1 <= M; c1 += 1)
8       S1(c0, c1);
9   }
10   for (int c1 = 1; c1 <= M; c1 += 1)
11     S2(N, c1);
12 }
13