#include <bits/stdc++.h>
using namespace std;
const int upper_inf = numeric_limits<int>::max();
const int lower_inf = numeric_limits<int>::min();
const string task = "DBG";
const int N = 1e6;
const int M = 1e9 + 7;
auto ans = 0;
int L[101][101], D[101][101];
long long T;
void init();
void reset();
void input();
void solve();
void ouput();
int tester(int nT);
int main() {
  init();
  reset();
  input();
  solve();
  ouput();
  return tester(0);
}
void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
void reset() {}
void input() { cin >> T; }
void solve() {
  int sz = 0;
  int i;
  for (i = 0; T; T /= 3, i++) {
    int x = T % 3;
    if (i) {
      sz += 2;
      D[i][i + 3] = L[i + 3][i] = 1;
      if (T >= 3) sz += 2, L[i][i + 4] = D[i + 4][i] = 1;
    }
    if (x < 2) sz++, L[i + 1][i + 3] = 1;
    if (x < 1) sz++, D[i + 3][i + 1] = 1;
  }
  L[i + 1][i + 2] = L[i + 2][i + 2] = 1;
  D[i + 2][i + 1] = D[i + 2][i + 2] = 1;
  cout << i + 3 << " " << i + 3 << "\n" << sz + 4 << "\n";
  for (int j = 1; j < i + 3; j++)
    for (int k = 1; k < i + 3; k++) {
      if (L[j][k]) cout << j << " " << k << " " << j << " " << k + 1 << "\n";
      if (D[j][k]) cout << j << " " << k << " " << j + 1 << " " << k << "\n";
    }
}
void ouput() {}
void gen() {
  srand(time(NULL));
  ofstream fi((task + ".INP").c_str());
  fi.close();
}
int checker() { return 0; }
int tester(int nT) {
  for (int iT = 1; iT <= nT; iT++) {
    cerr << "Test " << iT << ": ";
    gen();
    clock_t t0 = clock();
    init();
    reset();
    input();
    solve();
    clock_t t1 = clock();
    int temp = checker();
    if (temp == ans)
      cerr << "Passed";
    else
      return cerr << "Wrong, answer must be " << temp << ", not " << ans, 1;
    fprintf(stderr, " - %.4lfs.\n", (double)(t1 - t0) / 1000);
  }
  return 0;
}
