Problem: Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!

Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.

The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.

Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.

Input

The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).

After that, there are two strings s and t, consisting of n lowercase Latin letters each.

Output

If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number  - 1.

Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.

Examples

Input

6
abacbb
babcba


Output

4
6 3 2 3


Input

3
aba
bba


Output

-1

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.util.ArrayList;
import java.io.InputStream;

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

    static class CLockPuzzle {
        ArrayList<Integer> ans;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.readInt();
            String s = in.readLine();
            String t = in.readLine();
            char[] c1 = s.toCharArray();
            char[] c2 = t.toCharArray();
            Arrays.sort(c1);
            Arrays.sort(c2);
            for (int i = 0; i < n; i++) {
                if (c1[i] != c2[i]) {
                    out.println(-1);
                    return;
                }
            }
            if (n == 1) {
                out.println(0);
                return;
            }
            ans = new ArrayList<>();

            int len = 0, k = 0;
            for (int i = (n - 1) / 2, r = i + 1; i >= 0 && r < n; i--, k++, r++) {
                int x, y;
                if (k % 2 == 1) {
                    x = i;
                    y = r;
                } else {
                    x = r;
                    y = i;
                }

                for (int j = n - len - 1; j >= 0; j--) {
                    if (s.charAt(j) == t.charAt(x)) {
                        s = apply(s, n - j - 1);
                        s = apply(s, n);
                        s = apply(s, len);
                        break;
                    }
                }

                for (int j = n - 1; j >= 0; j--) {
                    if (s.charAt(j) == t.charAt(y)) {
                        if (j - len - 1 < 0) {
                            int w = 0;
                        }
                        s = apply(s, n - j);
                        s = apply(s, j - len - 1);
                        break;
                    }
                }
                len += 2;
            }
            if (k % 2 == 0) {
                if (n % 2 == 0) {
                    s = apply(s, n);
                } else {
                    s = apply(s, n - 1);
                    s = apply(s, 1);
                }
            }
            out.println(ans.size());
            for (int i : ans) out.print(i + " ");


        }

        String apply(String c, int x) {
            int n = c.length();
            StringBuilder sb = new StringBuilder(c);
            StringBuilder t = new StringBuilder(sb.substring(n - x));
            t.reverse();
            t.append(sb.substring(0, n - x));
            ans.add(x);
            return t.toString();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0)
                s = readLine0();
            return s;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}