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.*;
import java.util.*;

public class E implements Runnable{
	public static void main (String[] args) {new Thread(null, new E(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		String a = fs.next();
		String oa = a;
		String b = fs.next();

		if(a.length() == 1) {
			if(a.equals(b)) {
				System.out.println(0);
			}
			else {
				System.out.println(-1);
			}
			return;
		}
		
		int[] order = new int[n];
		int start = -1;
		if(((n-1)&1) == 0) start = n-1;
		else start = n-2;
		for(int i = 0; i < n; i++) {
			order[i] = start;
			if(start == 0) {
				start = 1;
			}
			else {
				if(start%2==0) start -= 2;
				else start += 2;
			}
		}
		
		int[] order2 = new int[n];
		for(int i = 0; i < n; i++) order2[order[i]] = i;
		order = order2.clone();
		
		int[] res = new int[6101];
		int left = -1, right = -1, ptr = 0;
		for(int i = 0; i < n; i++) {
			char look = b.charAt(order[i]);
			int pos = indexOf(a, look, left, right);
			
//			System.out.printf("%s\nBlock = [%d, %d]\nPos = %d\n\n", a, left, right, pos);
			
			if(pos < 0) {
				System.out.println(-1);
				return;
			}
			
			if(left < 0) {
				left = right = pos;
			}
			
			if(right < n) {
				//move it to the end
				String toFront = rev(a.substring(right+1));
//				System.out.println("Reversal " + toFront);
				res[ptr++] = right+1;
				a = toFront + a.substring(0, right+1);
				int len = right - left;
				if(pos > right) {
					//pos got shifted
					pos = n - pos - 1;
				}
				else {
					//pos was before the range it gets pushed forward
					pos += toFront.length();
				}
				right = n-1;
				left = right - len;
//				System.out.println("NextA " + a + " : " + left + " " + right + " " + pos);
			}
			
			if(i == 0) continue;
			//now move the segment at the end to the beginning
			String toFront = rev(a.substring(left));
			res[ptr++] = left;
			//at this point pos is guaranteed to be less than left
			a = toFront + a.substring(0, left);
			left = 0; right = toFront.length()-1;
			pos += toFront.length();
			
			//now we move the segment starting at pos to the end
			res[ptr++] = pos;
			toFront = rev(a.substring(pos));
			left += toFront.length() - 1; right += toFront.length();
			a = toFront + a.substring(0, pos);
			
//			System.out.println("Finished");
		}
		
		if(!a.equals(b)) {
			res[ptr++] = 0;
			a = rev(a);
		}
		
		for(int i = 0; i < ptr; i++) {
			res[i] = n - res[i];
		}
		
//		for(int i = 0; i < ptr; i++) {
//			if(res[i] == 0) continue;
//			String rev = rev(oa.substring(n - res[i]));
//			oa = rev + oa.substring(0, n - res[i]);
//		}
//		System.out.println(oa);
//		System.out.println(b);

		out.println(ptr);
		for(int i = 0; i < ptr; i++) {
			if(i > 0) out.print(" ");
			out.print(res[i]);
		}
		out.println();
		
		out.close();
	}
	
	int indexOf(String s, char look, int left, int right) {
		for(int i = 0; i < s.length(); i++) {
			if(i >= left && i <= right) continue;
			if(s.charAt(i) == look) {
				return i;
			}
		}
		return -1;
	}
	
	String rev(String a) { return new StringBuilder(a).reverse().toString(); }
	
	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				//                br = new BufferedReader(new FileReader("testdata.out"));
				st = new StringTokenizer("");
			} catch (Exception e){e.printStackTrace();}
		}
		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}
		public int nextInt() {return Integer.parseInt(next());}
		public long nextLong() {return Long.parseLong(next());}
		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			try {line = br.readLine();}
			catch (Exception e) {e.printStackTrace();}
			return line;
		}
		public Integer[] nextIntegerArray(int n) {
			Integer[] a = new Integer[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		public char[] nextCharArray() {return nextLine().toCharArray();}
	}

}