#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
typedef double LD;
long long T;
int n, m;
const int N = 50 + 5;
long long dp[N][N];
int dx[] = {1, 0, 0, -1};
int dy[] = {0, 1, -1, 0};
int r[N][N];
long long ans[N][N];
long long get(int sx, int sy, int fx, int fy) {
  ans[fx][fy] = 1;
  for (int i = fx; i >= sx; --i) {
    for (int j = fy; j >= sy; --j) {
      if (i == fx && j == fy) continue;
      ans[i][j] = 0;
      if (i + 1 <= fx && (r[i][j] & 1) == 0) ans[i][j] += ans[i + 1][j];
      if (j + 1 <= fy && (r[i][j] & 2) == 0) ans[i][j] += ans[i][j + 1];
    }
  }
  return ans[sx][sy];
}
long long F[2 * N];
long long as[N];
const long long INF = (long long)1000000000 * 1000000000;
int val[N];
void solve() {
  cin >> T;
  n = 41;
  m = n;
  for (int i = 1; i <= n; ++i) {
    if (i >= 2) {
      int j = max(1, i - 3);
      r[i][j] |= 2;
      j = min(n, i + 2);
      r[i][j] |= 2;
    }
    int j = min(n, i + 4);
    r[i][j] |= 2;
    if (i >= 6) {
      j = i - 5;
      r[i][j] |= 2;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (i >= 2) {
      int j = max(1, i - 3);
      r[j][i] |= 1;
      j = min(n, i + 2);
      r[j][i] |= 1;
    }
    int j = min(n, i + 4);
    r[j][i] |= 1;
    if (i >= 6) {
      j = i - 5;
      r[j][i] |= 1;
    }
  }
  as[0] = 1;
  int R = 0;
  for (int i = 1; i <= (int)(n); ++i) {
    as[i] = as[i - 1] * 3;
    if (as[i] * 3 > INF) {
      R = i;
      break;
    }
  }
  long long x = T;
  for (int i = (int)(R + 1) - 1; i >= 0; --i) {
    while (x >= as[i]) {
      x -= as[i];
      ++val[i];
    }
  }
  for (int i = 0; i < (int)(R + 1); ++i) {
    if (val[i] == 2) {
      int x = n - i;
      int y = n - 3 - i;
      r[x][y] ^= 2;
      swap(x, y);
      r[x][y] ^= 1;
    } else if (val[i] == 1) {
      int x = n - i;
      int y = n - 3 - i;
      r[x][y] ^= 2;
    }
  }
  std::vector<std::pair<int, int> > a;
  std::vector<std::pair<int, int> > b;
  for (int i = 1; i <= (int)(n); ++i) {
    for (int j = 1; j <= (int)(n); ++j) {
      if ((r[i][j] & 1) && i + 1 <= n) {
        a.push_back(make_pair(i, j));
        b.push_back(make_pair(i + 1, j));
      }
      if ((r[i][j] & 2) && j + 1 <= n) {
        a.push_back(make_pair(i, j));
        b.push_back(make_pair(i, j + 1));
      }
    }
  }
  cout << n << " " << m << endl;
  cout << ((int)((a).size())) << endl;
  for (int i = 0; i < (int)(((int)((a).size()))); ++i) {
    cout << a[i].first << " " << a[i].second << " " << b[i].first << " "
         << b[i].second << endl;
  }
}
void testgen() {
  FILE* f = fopen("input.txt", "w");
  fclose(f);
}
int main() {
  std::cout << std::fixed;
  std::cout.precision(8);
  std::cerr << std::fixed;
  std::cerr.precision(3);
  solve();
  return 0;
}
