#include <bits/stdc++.h>
using namespace std;
int main(void) {
  srand(time(0));
  cout << fixed << setprecision(7);
  cerr << fixed << setprecision(7);
  static int A[55][55];
  static int B[55][55];
  long long T;
  cin >> T;
  vector<int> ans;
  while (T) ans.push_back(T % 3), T /= 3;
  int sz = ans.size();
  for (int i = 0; i < sz; ++i) {
    int N = 3 + i;
    if (!ans[i])
      A[N][N - 2] = 1, B[N - 2][N] = 1;
    else if (ans[i] == 1)
      A[N][N - 2] = 1;
    if (i != sz - 1) B[N + 1][N - 2] = A[N - 2][N + 1] = 1;
    if (i == sz - 1) A[N][N - 1] = A[N][N] = B[N][N] = B[N - 1][N] = 1;
  }
  int n = 3 + sz;
  for (int i = 5; i < n; ++i)
    A[i - 4][i + 1] = B[i - 4][i] = B[i + 1][i - 4] = A[i][i - 4] = 1;
  cout << n << ' ' << n << '\n';
  set<vector<int> > S;
  static long long D[55][55];
  D[1][1] = 1;
  for (int i = 1; i < n; ++i)
    for (int j = 1; j <= n; ++j)
      if (A[i][j]) S.insert({i, j, i + 1, j});
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j < n; ++j)
      if (B[i][j]) S.insert({i, j, i, j + 1});
  cout << S.size() << '\n';
  for (auto it : S)
    cout << it[0] << ' ' << it[1] << ' ' << it[2] << ' ' << it[3] << '\n';
  cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms"
       << '\n';
  return 0;
}
