Problem: Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2."

Same with some writers, she wants to make an example with some certain output: for example, her birthday or the number of her boyfriend. Can you help her to make a test case with answer equal exactly to k?

Input

The first line contains a single integer k (1 ≤ k ≤ 109).

Output

You should output a graph G with n vertexes (2 ≤ n ≤ 1000). There must be exactly k shortest paths between vertex 1 and vertex 2 of the graph.

The first line must contain an integer n. Then adjacency matrix G with n rows and n columns must follow. Each element of the matrix must be 'N' or 'Y'. If Gij is 'Y', then graph G has a edge connecting vertex i and vertex j. Consider the graph vertexes are numbered from 1 to n.

The graph must be undirected and simple: Gii = 'N' and Gij = Gji must hold. And there must be at least one path between vertex 1 and vertex 2. It's guaranteed that the answer exists. If there multiple correct answers, you can output any of them. 

Examples

Input

2

Output

4
NNYY
NNYY
YYNN
YYNN

Input

9

Output

8
NNYYYNNN
NNNNNYYY
YNNNNYYY
YNNNNYYY
YNNNNYYY
NYYYYNNN
NYYYYNNN
NYYYYNNN

Input

1

Output

2
NY
YN

Note

In first example, there are 2 shortest paths: 1-3-2 and 1-4-2.

In second example, there are 9 shortest paths: 1-3-6-2, 1-3-7-2, 1-3-8-2, 1-4-6-2, 1-4-7-2, 1-4-8-2, 1-5-6-2, 1-5-7-2, 1-5-8-2.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
#pragma hdrstop
using namespace std;
inline void sIO() {}
inline void iIO() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
inline void fIO(string fn) {
  freopen((fn + ".in").c_str(), "r", stdin);
  freopen((fn + ".out").c_str(), "w", stdout);
}
inline void TM() {}
inline void swap(short& a, short& b) { b ^= a ^= b ^= a; }
inline void swap(int& a, int& b) { b ^= a ^= b ^= a; }
inline void swap(char& a, char& b) { b ^= a ^= b ^= a; }
inline void swap(long long& a, long long& b) { b ^= a ^= b ^= a; }
template <class T>
inline T abs(T x) {
  return x < 0 ? -x : x;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T min(T& a, T& b) {
  return a < b ? a : b;
}
template <class T>
inline T max(T& a, T& b) {
  return a > b ? a : b;
}
template <class T>
inline T gcd(T a, T b) {
  if (a < b) swap(a, b);
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
inline bool isPrime(T n) {
  if (n < 2) return false;
  T kk = (T)sqrt(n + 0.);
  for (T i = 2; i <= kk; ++i)
    if (!(n % i)) return false;
  return true;
}
template <class T>
inline string toa(T x) {
  stringstream ss;
  ss << x;
  string ret;
  ss >> ret;
  return ret;
}
template <class T>
inline T ppow(T a, long long b) {
  T ret = 1;
  while (b) {
    if (b & 1) ret *= a;
    a *= a;
    b >>= 1;
  }
  return ret;
}
template <class T>
inline T ppow(T a, long long b, long long md) {
  T ret = 1;
  a %= md;
  while (b) {
    if (b & 1) ret = ret * a % md;
    a = a * a % md;
    b >>= 1;
  }
  return ret % md;
}
inline int toi(string s) {
  stringstream ss;
  ss << s;
  int ret;
  ss >> ret;
  return ret;
}
inline long long tol(string s) {
  stringstream ss;
  ss << s;
  long long ret;
  ss >> ret;
  return ret;
}
inline int Random() { return ((rand() << 16) | rand()); }
inline int Random(int l, int r) {
  if (l == r) return l;
  return Random() % (r - l) + l;
}
inline char upperCase(char ch) {
  return (ch >= 'a' && ch <= 'z') ? ch ^ 32 : ch;
}
inline char lowerCase(char ch) {
  return (ch >= 'A' && ch <= 'Z') ? ch ^ 32 : ch;
}
inline string upperCase(string s) {
  int ls = s.length();
  for (int i = 0; i < ls; ++i)
    if (s[i] >= 'a' && s[i] <= 'z') s[i] ^= 32;
  return s;
}
inline string lowerCase(string s) {
  int ls = s.length();
  for (int i = 0; i < ls; ++i)
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] ^= 32;
  return s;
}
inline int dig(char ch) { return ch - 48; }
inline bool isAlpha(char ch) {
  return (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z');
}
inline bool isDigit(char ch) { return (ch >= '0' && ch <= '9'); }
inline bool isLowerCase(char ch) { return (ch >= 'a' && ch <= 'z'); }
inline bool isUpperCase(char ch) { return (ch >= 'A' && ch <= 'Z'); }
int __;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const int MD = 1000000007;
int n, cur, cnt, __MY_PREV__, cx, len[32], diff, a[32], tmp, cc, curlen, v,
    ans[1111][1111];
vector<int> level[32], g[2222], curl, prl;
bool good[32];
const char s[] = "NY";
int build(int len) {
  int ret = 1;
  for (int i = 0; i < len; ++i) {
    int nv = ++cur;
    g[ret].push_back(nv), g[nv].push_back(ret);
    ret = nv;
  }
  return ret;
}
void construct(int from, int to) {
  prl.clear(), prl.push_back(from);
  for (int i = 0; i < cc; ++i) {
    curl.clear();
    int nd = (1 << a[i]);
    for (int j = 0; j < nd; ++j) curl.push_back(++cur);
    for (auto j : prl)
      for (auto k : curl) g[j].push_back(k), g[k].push_back(j);
    prl.clear();
    for (auto j : curl) prl.push_back(j);
  }
  for (auto i : prl)
    for (auto j : level[to]) g[i].push_back(j), g[j].push_back(i);
}
int main() {
  sIO();
  scanf("%d", &n), cur = 2, __MY_PREV__ = -1, memset(good, 0, sizeof(good)),
                   cx = 9;
  for (int lvl = 29, x = 1; lvl > 0; lvl -= x++) {
    good[lvl] = true, len[lvl] = cx--;
    if (lvl > 1)
      cnt = (1 << x);
    else
      cnt = 2;
    for (int i = 0; i < cnt; ++i) level[lvl].push_back(++cur);
    if (lvl < 29)
      for (auto i : level[__MY_PREV__])
        for (auto j : level[lvl]) g[i].push_back(j), g[j].push_back(i);
    __MY_PREV__ = lvl;
  }
  for (auto i : level[1]) {
    g[i].push_back(2), g[2].push_back(i);
  }
  cx = 29;
  for (int bit = 29; bit >= 0; --bit)
    if (n & (1 << bit)) {
      if (!bit) {
        v = build(7);
        g[v].push_back(level[1][0]), g[level[1][0]].push_back(v);
        break;
      }
      while (cx > bit) {
        --cx;
        while (!good[cx]) --cx;
      }
      tmp = diff = bit - cx, cc = 0;
      while (tmp)
        if (tmp >= 2)
          tmp -= (a[cc++] = 2);
        else
          tmp -= (a[cc++] = 1);
      curlen = len[cx] + cc;
      v = build(9 - curlen);
      construct(v, cx);
    }
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= cur; ++i)
    for (auto j : g[i]) {
      ans[i][j] = 1;
    }
  printf("%d\n", cur);
  for (int i = 1; i <= cur; ++i) {
    for (int j = 1; j <= cur; ++j) putchar(s[ans[i][j]]);
    printf("\n");
  }
  return 0;
}