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:
//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class B {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter writer = new PrintWriter(System.out);
    StringTokenizer stringTokenizer;

    B() throws IOException {
//        reader = new BufferedReader(new FileReader("cycle2.in"));
//        writer = new PrintWriter(new FileWriter("cycle2.out"));
    }

    String next() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(reader.readLine());
        }
        return stringTokenizer.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    int[][] mul(int[][] a, int[][] b) {
        int[][] result = new int[2][2];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                for (int k = 0; k < 2; k++) {
                    result[i][j] = sum(result[i][j], product(a[i][k], b[k][j]));
                }
            }
        }
        return result;
    }

    int[][] pow(int[][] a, int k) {
        int[][] result = {{1, 0}, {0, 1}};
        while (k > 0) {
            if (k % 2 == 1) {
                result = mul(result, a);
            }
            a = mul(a, a);
            k /= 2;
        }
        return result;
    }

    final int MOD = 1000 * 1000 * 1000 + 9;

    int sum(int a, int b) {
        a += b;
        return a >= MOD ? a - MOD : a;
    }

    int product(int a, int b) {
        return (int) (1l * a * b % MOD);
    }

    @SuppressWarnings("unchecked")
    void solve() throws IOException {
        final int k = nextInt();
        class Node {
            List<Node> neighbors = new ArrayList<>(1 << 10);
            int dist = 0;
            int numberOfPaths = 1;

            Node newNeighbor() {
                Node neighbor = new Node();
                neighbor.dist = this.dist + 1;
                addNeighbor(neighbor);
                return neighbor;
            }

            void addNeighbor(Node neighbor) {
                neighbors.add(neighbor);
                neighbor.neighbors.add(this);
                neighbor.numberOfPaths += this.numberOfPaths;
            }
        }
        Node from = new Node();
        Node to = new Node();
        final int maxBit = 30;
        to.dist = maxBit + 1;
        Node a = from.newNeighbor();
        Node b = from.newNeighbor();
        Node[] nodes = new Node[maxBit];
        nodes[0] = a;
        for(int i = 1; i < maxBit; i++) {
            Node u = a.newNeighbor();
            Node v = b.newNeighbor();
            a.addNeighbor(v);
            b.addNeighbor(u);
            a = u;
            b = v;
            nodes[i] = a;
        }
        for(int i = 0; i < maxBit; i++) {
            if((k >> i) % 2 == 1) {
                Node node = nodes[i];
                while(node.dist != to.dist - 1) {
                    node = node.newNeighbor();
                }
                node.addNeighbor(to);
            }
        }
        class Utils {
            Map<Node, Integer> ids = new HashMap<>();
            List<Node> nodes = new ArrayList<>(1 << 10);
            void markNode(Node node) {
                int mark = nodes.size();
                ids.put(node, mark);
                nodes.add(node);
            }

            void dfs(Node node) {
                for (Node neighbor : node.neighbors) {
                    if(!ids.containsKey(neighbor)) {
                        markNode(neighbor);
                        dfs(neighbor);
                    }
                }
            }

            void print() {
                int n = nodes.size();
                writer.println(n);
                for (Node node : nodes) {
                    char[] row = new char[n];
                    Arrays.fill(row, 'N');
                    for (Node neighbor : node.neighbors) {
                        row[ids.get(neighbor)] = 'Y';
                    }
                    writer.println(row);
                }
            }

            void debugPrint() {
                for (Node node : nodes) {
                    for (Node neighbor : node.neighbors) {
                        final Integer u = ids.get(node);
                        final Integer v = ids.get(neighbor);
                        if(u < v) {
                            writer.println(u + " " + v);
                        }
                    }
                }
            }
        }
        Utils utils = new Utils();
        utils.markNode(from);
        utils.markNode(to);
        utils.dfs(from);
        utils.print();
//        utils.debugPrint();
        writer.close();
    }

    public static void main(String[] args) throws IOException {
        new B().solve();
    }

}