#include <bits/stdc++.h>
using namespace std;
long long T, now = 1;
int opt, n, m, k = 0, cnt = -1, num[40];
struct edge {
  int x1, y1, x2, y2;
} e[500];
void write(int val) {
  if (val < 0) {
    putchar('-');
    write(-val);
    return;
  }
  if (val < 10) {
    putchar(val + '0');
    return;
  }
  write(val / 10);
  putchar(val % 10 + '0');
}
void build_edge(int x1, int y1, int x2, int y2) {
  k++;
  e[k].x1 = x1;
  e[k].y1 = y1;
  e[k].x2 = x2;
  e[k].y2 = y2;
}
int main() {
  scanf("%lld%d", &T, &opt);
  while (T) {
    num[++cnt] = T % 3;
    T /= 3;
  }
  printf("%d %d\n", cnt + 4, cnt + 4);
  for (int i = 1; i < cnt; i++) {
    build_edge(i, i + 4, i, i + 5);
    build_edge(i + 4, i, i + 5, i);
  }
  for (int i = 1; i <= cnt; i++) {
    build_edge(i, i + 3, i + 1, i + 3);
    build_edge(i + 3, i, i + 3, i + 1);
  }
  build_edge(cnt + 2, cnt + 3, cnt + 2, cnt + 4);
  build_edge(cnt + 3, cnt + 2, cnt + 4, cnt + 2);
  build_edge(cnt + 3, cnt + 3, cnt + 3, cnt + 4);
  build_edge(cnt + 3, cnt + 3, cnt + 4, cnt + 3);
  for (int i = 0; i <= cnt; i++) {
    if (num[i] < 1) {
      build_edge(i + 1, i + 3, i + 1, i + 4);
    }
    if (num[i] < 2) {
      build_edge(i + 3, i + 1, i + 4, i + 1);
    }
  }
  printf("%d\n", k);
  for (int i = 1; i <= k; i++) {
    write(e[i].x1);
    putchar(' ');
    write(e[i].y1);
    putchar(' ');
    write(e[i].x2);
    putchar(' ');
    write(e[i].y2);
    putchar(' ');
    printf("\n");
  }
  return 0;
}
