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.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
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);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int K = in.nextInt();
        int S = 0;
        int T = 1;
        int cur = 2;
        int pow10 = 0;
        while (K != 0) {
            int mod = K % 10;
            cur = constructPath(mod, pow10, 12, cur, S, T);
            K /= 10;
            pow10++;
        }
//        for (Edge e : edges) {
//            out.println(e.a + " " + e.b);
//        }
        buildFinalGraph(out);
    }

    int constructPath(int mod, int pow10, int len, int cur, int S, int T) {
        if (mod == 0) return cur;
        addEdge(S, cur);
        for (int i = 0; i < pow10; ++i) {
            for (int j = 0; j < 10; ++j) {
                addEdge(cur, cur + j + 1);
                addEdge(cur + j + 1, cur + 11);
            }
            cur = cur + 11;
            --len;
        }
        for (int j = 0; j < mod; ++j) {
            addEdge(cur, cur + j + 1);
            addEdge(cur + j + 1, cur + mod + 1);
        }
        cur = cur + mod + 1;
        --len;
        for (int i = 0; i < len; ++i) {
            addEdge(cur, cur + 1);
            addEdge(cur + 1, cur + 2);
            ++cur;
            ++cur;
        }
        addEdge(cur, T);
        return cur + 1;
    }

    boolean[][] g;

    void buildFinalGraph(PrintWriter out) {
        int n = 0;
        for (Edge e : edges) {
            n = Math.max(n, e.getMax());
        }
        if (n >= 1000) {
            throw new AssertionError("Too many vertices! " + String.valueOf(n));
        }
        g = new boolean[n + 1][n + 1];
        for (Edge e : edges) {
            g[e.a][e.b] = g[e.b][e.a] = true;
        }
        out.println(n + 1);
        for (int i = 0; i <= n; ++i) {
            for (int j = 0; j <= n; ++j) {
                out.print(g[i][j] ? 'Y' : 'N');
            }
            out.println();
        }
    }

    void addEdge(int a, int b) {
        if (edges == null) {
            edges = new ArrayList<Edge>();
        }
        edges.add(new Edge(a, b));
    }

    List<Edge> edges = null;

    class Edge {
        int a, b;

        public Edge(int a, int b) {
            this.a = a;
            this.b = b;
        }

        public int getMax() {
            return Math.max(a, b);
        }
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}

