#include <bits/stdc++.h>
using namespace std;
int n, m;
int pow_door1[100100][4];
int pow_door2[100100][4];
int closed_door[100100][4], cnt;
long long t;
long long d[20][20];
void add_pow_door(int(*door), int x1, int y1, int x2, int y2) {
  door[0] = x1;
  door[1] = y1;
  door[2] = x2;
  door[3] = y2;
}
bool check(int k) { return (k == 0) || (k > n); }
void close_door(int x1, int y1, int x2, int y2) {
  if (check(x1) || check(x2) || check(y1) || check(y2)) return;
  closed_door[cnt][0] = x1;
  closed_door[cnt][1] = y1;
  closed_door[cnt][2] = x2;
  closed_door[cnt][3] = y2;
  cnt++;
}
int main() {
  n = m = 37 + 4;
  add_pow_door(pow_door1[0], 1, 4, 1, 5);
  add_pow_door(pow_door2[0], 4, 1, 5, 1);
  int i1 = 2, j1 = 4;
  for (int i = 1; i <= 37; i++) {
    add_pow_door(pow_door1[i], i1, j1, i1, j1 + 1);
    close_door(i1, j1, i1 - 1, j1);
    add_pow_door(pow_door2[i], j1, i1, j1 + 1, i1);
    close_door(j1, i1, j1, i1 - 1);
    i1++;
    j1++;
  }
  j1--;
  close_door(i1, j1, i1, j1 + 1);
  close_door(j1, i1, j1 + 1, i1);
  i1++;
  close_door(i1, j1, i1, j1 + 1);
  close_door(j1, i1, j1 + 1, i1);
  i1 = 1;
  j1 = 5;
  for (int i = 1; i <= n; i++) {
    close_door(i1, j1, i1, j1 + 1);
    close_door(i1, j1, i1 - 1, j1);
    close_door(j1, i1, j1 + 1, i1);
    close_door(j1, i1, j1, i1 - 1);
    i1++;
    j1++;
  }
  cin >> t;
  long long cur = 1ll;
  for (int i = 1; i <= 37; i++) cur *= 3ll;
  for (int i = 37; i >= 0; i--) {
    long long cnum = t / cur;
    if (cnum == 1ll)
      close_door(pow_door1[i][0], pow_door1[i][1], pow_door1[i][2],
                 pow_door1[i][3]);
    else if (cnum == 0ll) {
      close_door(pow_door2[i][0], pow_door2[i][1], pow_door2[i][2],
                 pow_door2[i][3]);
      close_door(pow_door1[i][0], pow_door1[i][1], pow_door1[i][2],
                 pow_door1[i][3]);
    }
    t -= cnum * cur;
    cur /= 3ll;
  }
  cout << n << ' ' << m << endl << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    if (closed_door[i][0] + closed_door[i][1] >
        closed_door[i][2] + closed_door[i][3]) {
      swap(closed_door[i][0], closed_door[i][2]);
      swap(closed_door[i][1], closed_door[i][3]);
    }
    cout << closed_door[i][0] << ' ' << closed_door[i][1] << ' '
         << closed_door[i][2] << ' ' << closed_door[i][3] << endl;
  }
  return 0;
}
