#include <bits/stdc++.h>
void findRowCol(int rowLen[52], int *xi, int *yi, int size, int curr) {
  int temp = 0;
  *xi = 0;
  while (temp < curr) {
    temp += rowLen[*xi];
    (*xi)++;
  }
  *yi = curr - (temp - rowLen[(*xi) - 1]);
  return;
}
int main() {
  int n, table[3000], table2[3000], s, i, noOfSwaps, xi, yi, pi, qi, temp,
      rowLen[52], swaps[3000][4];
  scanf("%d", &n);
  s = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &rowLen[i]);
    s += rowLen[i];
  }
  for (i = 1; i <= s; i++) {
    scanf("%d", &table[i]);
    table2[table[i]] = i;
  }
  noOfSwaps = 0;
  for (i = 1; i <= s; i++) {
    if (table[i] != i) {
      findRowCol(rowLen, &xi, &yi, n, i);
      findRowCol(rowLen, &pi, &qi, n, table2[i]);
      swaps[noOfSwaps][0] = xi;
      swaps[noOfSwaps][1] = yi;
      swaps[noOfSwaps][2] = pi;
      swaps[noOfSwaps][3] = qi;
      temp = table[i];
      table[i] = table[table2[i]];
      table[table2[i]] = temp;
      temp = table2[i];
      table2[i] = i;
      table2[table[temp]] = temp;
      noOfSwaps++;
    }
  }
  printf("%d\n", noOfSwaps);
  for (i = 0; i < noOfSwaps; i++) {
    printf("%d %d %d %d\n", swaps[i][0], swaps[i][1], swaps[i][2], swaps[i][3]);
  }
  return 0;
}
