#include <cstdio>
#include <ctime>
#include <algorithm>

using namespace std;

typedef long long ll;

const int maxn = 1000;

ll rdtsc() {
  ll tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}

int p[maxn];

int main() {
  srand(rdtsc());
  freopen("lanes.in", "w", stdout);
  int n = rand() % maxn + 1;
  for (int i = 0; i < n; i++)
    p[i] = i;
  random_shuffle(p, p + n);
  printf("%d\n", n);
  for (int i = 1; i < n; i++) {
    int index = rand() % i;
    printf("%d %d %d %d\n", p[index] + 1, p[i] + 1, rand() % 10001, rand() % 2);
  }
}