#include <bits/stdc++.h>
using namespace std;
bool chkmin(int &x, int y) { return x > y ? x = y, 1 : 0; }
bool chkmax(int &x, int y) { return x < y ? x = y, 1 : 0; }
long long rd() {
  long long ret = 0;
  bool fl = 0;
  char ch = 0;
  while (!isdigit(ch)) fl |= (ch == '-'), ch = getchar();
  while (isdigit(ch)) ret = (ret << 1) + (ret << 3) + (ch ^ 48), ch = getchar();
  return fl ? -ret : ret;
}
struct WLL {
  int lx, ly, rx, ry;
  WLL(int LX = 0, int LY = 0, int RX = 0, int RY = 0) {
    lx = LX, ly = LY, rx = RX, ry = RY;
  }
  bool del(int lmt) {
    return (lx > lmt || ly > lmt || rx > lmt || ry > lmt) ||
           ((lx * ly * rx * ry) == 0);
  }
  void out() {
    printf("%d %d %d %d\n", lx, ly, rx, ry);
    return;
  }
};
vector<WLL> ans;
void add(int sx, int sy, int ex, int ey) { ans.push_back(WLL(sx, sy, ex, ey)); }
void addd(int sx, int sy, int ex, int ey) {
  add(sx, sy, ex, ey), add(sy, sx, ey, ex);
}
void xpd(int x) {
  addd(x, x - 3, x, x - 2), addd(x + 2, x - 3, x + 2, x - 2),
      addd(x + 2, x - 2, x + 3, x - 2);
}
void build(int x, int d) {
  xpd(x);
  if (d == 2) return;
  add(x - 2, x, x - 2, x + 1);
  if (d) return;
  add(x, x - 2, x + 1, x - 2);
}
void fnl(int x) {
  return addd(x, x, x, x + 1), addd(x - 1, x, x - 1, x + 1), void();
}
int d[250], cnt;
int main() {
  long long T = rd();
  int pos = 0;
  for (long long i = T; i; i /= 3) d[++cnt] = i % 3;
  if (cnt) pos += 3;
  for (int i = 1; i <= cnt; ++i) build(pos, d[i]), ++pos;
  fnl(pos - 1);
  printf("%d %d\n", pos, pos);
  int tot = (signed)ans.size();
  for (int i = 0; i <= (signed)ans.size() - 1; ++i)
    if (ans[i].del(pos)) tot--;
  printf("%d\n", tot);
  for (int i = 0; i <= (signed)ans.size() - 1; ++i)
    if (!ans[i].del(pos)) ans[i].out();
}
