#include <bits/stdc++.h>
const int N = 39;
int dn[N + 1][N + 1], rt[N + 1][N + 1];
long long target;
int main() {
  scanf("%lld", &target);
  for (int i = 1; i < N; i++)
    for (int j = 1; j <= N; j++) {
      dn[i][j] = 1;
      rt[j][i] = 1;
    }
  for (int i = 1; i <= N - 5; i++) {
    dn[i + 4][i] = 0;
    rt[i + 5][i] = 0;
    rt[i][i + 4] = 0;
    dn[i][i + 5] = 0;
  }
  for (int i = 2; i <= N - 3; i++) {
    dn[i + 2][i] = 0;
    rt[i + 3][i] = 0;
    rt[i][i + 2] = 0;
    dn[i][i + 3] = 0;
  }
  dn[1][2] = 0;
  dn[1][3] = 0;
  dn[1][4] = 0;
  rt[2][1] = 0;
  rt[3][1] = 0;
  rt[4][1] = 0;
  for (int x = N - 3, y = N; x; x--, y--) {
    if (target % 3 > 0) dn[x][y] = 1;
    if (target % 3 > 1) rt[y][x] = 1;
    target /= 3;
  }
  switch (target) {
    case 0:
      break;
    case 1:
      dn[1][3] = 1;
      break;
    case 4:
      rt[3][1] = 1;
    case 3:
      dn[1][3] = 1;
    case 2:
      dn[1][2] = 1;
      break;
    case 6:
      rt[3][1] = 1;
    case 5:
      dn[1][2] = 1;
      rt[2][1] = 1;
      dn[1][3] = 1;
      break;
  }
  int edge = 0;
  for (int i = 1; i < N; i++)
    for (int j = 1; j <= N; j++) edge += !dn[i][j] + !rt[j][i];
  printf("%d %d\n%d\n", N, N, edge);
  for (int i = 1; i < N; i++)
    for (int j = 1; j <= N; j++) {
      if (!dn[i][j]) printf("%d %d %d %d\n", i, j, i + 1, j);
      if (!rt[j][i]) printf("%d %d %d %d\n", j, i, j, i + 1);
    }
  return 0;
}
