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>
using namespace std;
const long long ln = 30;
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long n;
  cin >> n;
  if (n == 1) {
    cout << "2\n";
    cout << "NY\n";
    cout << "YN\n";
    return 0;
  }
  long long req_nodes = 2;
  long long mx_dist = 0;
  long long cnt = 0;
  for (long long i = ln; i > 0; i--) {
    if ((n >> i) & 1) {
      cnt++;
      if (mx_dist == 0) mx_dist = i;
      req_nodes += 2 * i;
    }
  }
  req_nodes += mx_dist;
  cout << req_nodes << '\n';
  long long m = req_nodes;
  char ans[m + 1][m + 1];
  for (long long i = 1; i <= m; i++) {
    for (long long j = 1; j <= m; j++) ans[i][j] = 'N';
  }
  vector<long long> lvl;
  lvl.push_back(1);
  long long cur = 3;
  for (long long i = 0; i < mx_dist; i++) {
    ans[lvl.back()][cur] = 'Y';
    ans[cur][lvl.back()] = 'Y';
    lvl.push_back(cur++);
  }
  for (long long i = ln; i > 0; i--) {
    if ((n >> i) & 1) {
      vector<long long> jt;
      for (long long j = 0; j < i; j++) {
        jt.push_back(cur++);
        jt.push_back(cur++);
      }
      ans[1][jt[0]] = 'Y';
      ans[jt[0]][1] = 'Y';
      ans[1][jt[1]] = 'Y';
      ans[jt[1]][1] = 'Y';
      for (long long j = 2; j < 2 * i; j += 2) {
        ans[jt[j - 2]][jt[j]] = 'Y';
        ans[jt[j - 1]][jt[j]] = 'Y';
        ans[jt[j - 2]][jt[j + 1]] = 'Y';
        ans[jt[j - 1]][jt[j + 1]] = 'Y';
        ans[jt[j]][jt[j - 1]] = 'Y';
        ans[jt[j]][jt[j - 2]] = 'Y';
        ans[jt[j + 1]][jt[j - 1]] = 'Y';
        ans[jt[j + 1]][jt[j - 2]] = 'Y';
      }
      if (i == mx_dist) {
        ans[jt[2 * i - 2]][2] = 'Y';
        ans[jt[2 * i - 1]][2] = 'Y';
        ans[2][jt[2 * i - 2]] = 'Y';
        ans[2][jt[2 * i - 1]] = 'Y';
      } else {
        ans[jt[2 * i - 2]][lvl[i + 1]] = 'Y';
        ans[jt[2 * i - 1]][lvl[i + 1]] = 'Y';
        ans[lvl[i + 1]][jt[2 * i - 1]] = 'Y';
        ans[lvl[i + 1]][jt[2 * i - 2]] = 'Y';
      }
    }
  }
  if ((n & 1) || cnt > 1) {
    ans[2][lvl.back()] = 'Y';
    ans[lvl.back()][2] = 'Y';
  }
  if (!(n & 1)) {
    ans[1][3] = ans[3][1] = 'N';
  }
  for (long long i = 1; i <= m; i++) {
    for (long long j = 1; j <= m; j++) cout << ans[i][j];
    cout << '\n';
  }
}