// By Egor Suvorov from 120130.matrix

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <cassert>

const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };

using namespace std;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

#define pb push_back
#define mp make_pair
vector<string> f;

int main(int argc, char *argv[]) {
  assert(argc >= 2);
  int w = atoi(argv[1]);
  int h = w;

  f = vector<string>(h, string(w, 'B'));
  {
    bool ty = false;
    for (int s = 2; s <= w + h - 2; s += 3) {
      pii fir(-1, -1), las(-1, -1);
      for (int x = 0; x < w; x++) {
        int y = s - x;
        if (y < 0 || y >= h) continue;
        if (fir.first < 0) fir = mp(x, y);
        las = mp(x, y);
        f[y][x] = '.';
      }

      if (!ty) f[fir.second][fir.first] = 'B';
      else     f[las.second][las.first] = 'B';

      ty = !ty;
    }
  }
  f[h - 1][w - 1] = 'B';

  vvi fr(h, vi(w, -1));
  vvb was(h, vb(w, false));

  fr[0][0] = -2;
  deque<pii> q;
  q.pb(mp(0, 0));
  while (!q.empty()) {
    int x = q.front().first, y = q.front().second;
    q.pop_front();

    for (int i = 0; i < 4; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
      if (f[ny][nx] != 'B') continue;
      if (fr[ny][nx] != -1) continue;
      fr[ny][nx] = i ^ 2;
      q.pb(mp(nx, ny));
    }
  }

  f = vector<string>(h, string(w, 'W'));
  {
    int x = w - 1, y = h - 1;
    for (;;) {
      f[y][x] = 'B';
      int d = fr[y][x];
      if (d < 0) break;
      x += dx[d];
      y += dy[d];
    }
  }

  printf("%d\n", w);
  for (int y = 0; y < h; y++) {
    printf("%s\n", f[y].c_str());
  }
  return 0;
}
