#include <bits/stdc++.h>
inline void in(int &MAGNUS) { scanf("%d", &MAGNUS); }
inline void out(int MAGNUS) { printf("%d\n", MAGNUS); }
inline void in(int &MAGNUS, int &CLAR) { scanf("%d%d", &MAGNUS, &CLAR); }
inline void out(int MAGNUS, int CLAR) { printf("%d %d\n", MAGNUS, CLAR); }
inline void inl(long long &LIV) { scanf("%lld", &LIV); }
inline void inl(long long &LIV, long long &MART) {
  scanf("%lld%lld", &LIV, &MART);
}
inline void outl(long long LIV) { printf("%lld\n", LIV); }
inline void outl(long long LIV, long long MART) {
  printf("%lld %lld\n", LIV, MART);
}
using namespace std;
long long dif;
int N, walls = 0;
bool ver[55][55], hor[55][55];
int main() {
  inl(dif);
  int cur = 0;
  for (cur = 0; dif > 0; dif /= 3, cur++) {
    if (cur > 0) {
      ver[cur + 3][cur] = 1;
      hor[cur][cur + 3] = 1;
      walls += 2;
      if (dif >= 3) {
        ver[cur][cur + 4] = 1;
        hor[cur + 4][cur] = 1;
        walls += 2;
      }
    }
    int mod = dif % 3;
    if (mod == 0) {
      walls += 2;
      ver[cur + 1][cur + 3] = 1;
      hor[cur + 3][cur + 1] = 1;
    } else if (mod == 1) {
      walls++;
      ver[cur + 1][cur + 3] = 1;
    }
  }
  walls += 4;
  ver[cur + 1][cur + 2] = ver[cur + 2][cur + 2] = 1;
  hor[cur + 2][cur + 1] = hor[cur + 2][cur + 2] = 1;
  N = cur + 3;
  out(N, N);
  out(walls);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      if (ver[i][j]) printf("%d %d %d %d\n", i, j, i, j + 1);
      if (hor[i][j]) printf("%d %d %d %d\n", i, j, i + 1, j);
    }
  }
  return 0;
}
