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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author NMouad21
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    BFoxAndMinimalPath solver = new BFoxAndMinimalPath();
    solver.solve(1, in, out);
    out.close();
  }

  static class BFoxAndMinimalPath {

    public final void solve(int testNumber, InputReader in, PrintWriter out) {
      char[][] ans = new char[1000][1000];
      ArrayUtils.deepFill(ans, 'N');

      final int k = in.nextInt();
      int next = 2;
      int[] id = new int[30];
      boolean first = true;
      for (int i = 0; i < 30; i++) {
        if ((k >> i & 1) == 1) {
          int[] last = new int[]{0, 0};
          for (int j = 0; j < i; j++) {
            link(ans, last[0], next);
            link(ans, last[1], next);
            ++next;
            link(ans, last[0], next);
            link(ans, last[1], next);
            ++next;
            last[0] = next - 2;
            last[1] = next - 1;
          }
          if (first) {
            first = false;
            for (int j = i; j < 30; j++) {
              id[j] = next;
              link(ans, last[0], next);
              link(ans, last[1], next);
              last[0] = last[1] = next++;
            }
            link(ans, last[0], 1);
            link(ans, last[1], 1);
          } else {
            link(ans, last[0], id[i]);
            link(ans, last[1], id[i]);
          }
        }
      }

      out.println(next);
      ans = Arrays.copyOf(ans, next);
      for (char[] s : ans) {
        out.println(Arrays.copyOf(s, next));
      }
    }

    private final void link(char[][] ans, int i, int j) {
      ans[i][j] = ans[j][i] = 'Y';
    }

  }

  static final class ArrayUtils {

    private ArrayUtils() {
      throw new RuntimeException("DON'T");
    }

    public static final void deepFill(Object o, char v) {
      if (!o.getClass().isArray()) {
        throw new IllegalArgumentException();
      }
      if (o instanceof char[]) {
        char[] arr = (char[]) o;
        Arrays.fill(arr, v);
      } else if (o instanceof Character[]) {
        Character[] arr = (Character[]) o;
        Arrays.fill(arr, v);
      } else {
        Object[] objArray = (Object[]) o;
        for (Object obj : objArray) {
          deepFill(obj, v);
        }
      }
    }

  }

  static final class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[1 << 16];
    private int curChar;
    private int numChars;

    public InputReader() {
      this.stream = System.in;
    }

    public InputReader(final InputStream stream) {
      this.stream = stream;
    }

    private final int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public final int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) { // 45 == '-'
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) { // 48 == '0', 57 == '9'
        res *= 10;
        res += c - 48; // 48 == '0'
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    private static final boolean isSpaceChar(final int c) {
      return c == 32 || c == 10 || c == 13 || c == 9
          || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
    }

  }
}