#include <bits/stdc++.h>
using namespace std;
int n, m, K, op, a[50];
long long T, M, sl, fh;
struct Line {
  int faqx1, faqy1, faqx2, faqy2;
};
vector<Line> ans;
long long rd() {
  sl = 0;
  fh = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') sl = sl * 10 + ch - '0', ch = getchar();
  return sl * fh;
}
int main() {
  T = rd();
  long long x = T;
  n = 1;
  for (; x; ++n, x /= 3)
    ;
  ++n;
  for (int i = 1; i <= n; ++i) {
    if (i + 3 >= n) break;
    ans.push_back((Line){i, i + 3, i + 1, i + 3});
    ans.push_back((Line){i + 3, i, i + 3, i + 1});
  }
  ans.push_back((Line){n - 1, n - 1, n - 1, n});
  ans.push_back((Line){n - 1, n - 1, n, n - 1});
  for (int i = 1; T; a[i++] = T % 3, T /= 3)
    ;
  if (a[n - 2] == 1) ans.push_back((Line){n - 2, n - 1, n - 2, n});
  for (int i = n - 3; i; --i) {
    if (a[i] <= 0) ans.push_back((Line){i + 2, i, i + 3, i});
    if (a[i] <= 1) ans.push_back((Line){i, i + 2, i, i + 3});
    if (i + 5 <= n) ans.push_back((Line){i, i + 4, i, i + 5});
    if (i + 5 <= n) ans.push_back((Line){i + 4, i, i + 5, i});
  }
  printf("%d %d\n%d\n", n, n, K = (int)ans.size());
  for (int i = 0; i < K; ++i)
    printf("%d %d %d %d\n", ans[i].faqx1, ans[i].faqy1, ans[i].faqx2,
           ans[i].faqy2);
  return 0;
}
