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.
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.awt.Point;
import java.math.BigInteger;

import static java.lang.Math.*;

public class CodeforcesB implements Runnable {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new CodeforcesB(), "", 128 * (1L << 20)).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    void debug(Object... objects) {
        if (DEBUG) {
            for (Object o : objects) {
                System.err.println(o.toString());
            }
        }
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            time();
            memory();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    boolean DEBUG = false;

    int[] d;
    int k;
    boolean[][] graph;

    void connect(int x1, int y1, int x2, int y2) {
        int idx1 = x1 * 30 + y1 + 2;
        int idx2 = x2 * 30 + y2 + 2;
        graph[idx1][idx2] = true;
        graph[idx2][idx1] = true;
    }

    void solve() throws IOException {

        k = readInt();
        d = new int[1000 + 1];
        d[1] = 1;
        graph = new boolean[1000 + 1][1000 + 1];

        int[] pows = new int[30];
        pows[0] = 1;
        for (int i = 1; i < 30; i++)
            pows[i] = pows[i - 1] * 2;

        boolean[] t = new boolean[30];

        int kk = k;

        while (kk > 0) {
            for (int i = 29; i >= 0; i--)
                if (pows[i] <= kk) {
                    kk -= pows[i];
                    t[i] = true;
                }
        }

        int[][] preGraph = new int[30][30];
        for (int i = 0; i < 30; i++)
            preGraph[0][i] = 1;

        for (int i = 1; i < 30; i++) {
            for (int j = 0; j < 30; j++) {
                connect(i, j, i - 1, j);
            }
            for (int j = 0; j < i; j++)
                preGraph[i][j] = preGraph[i - 1][j];

            for (int j = i; j < 30; j++) {
                preGraph[i][j] = pows[i];
                connect(i, j, i-1, i-1);
            }
        }

        /*
         * for (int i=0; i<50; i++) { for (int j=0; j<50; j++)
         * out.print((graph[i][j]? "Y" : "N")); out.println(); }
         */

        out.println(30 * 30 + 2);

        for (int i=0; i<30; i++) {
            graph[0][i+2] = true;
            graph[i+2][0] = true;
        }
        
        for (int i=0; i<30; i++) 
            if (t[i]) {
                graph[29 * 30 + i + 2][1] = true;
                graph[1][29 * 30 + i + 2] = true;
            }
        
        for (int i=0; i<902; i++) {
            for (int j =0; j<902; j++)
                out.print(graph[i][j]? "Y" : "N");
            out.println();
        }

    }
}