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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T, class U>
inline void print(T first, U second) {
  printsp(first);
  println(second);
}
template <class T, class U, class V>
inline void print(T first, U second, V z) {
  printsp(first);
  printsp(second);
  println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int fail[101010];
char s[101010], s1[101010], t[101010], t1[101010], s2[101010];
void build_fail_function(char B[], int len) {
  int j = fail[0] = -1;
  for (int i = 1; i < len; i++) {
    while (j != -1 and B[j + 1] != B[i]) j = fail[j];
    if (B[j + 1] == B[i]) j++;
    fail[i] = j;
  }
}
int main() {
  int n;
  gn(n);
  scanf("%s%s", s, t);
  strcpy(s1, s);
  strcpy(t1, t);
  sort(s1, s1 + n);
  sort(t1, t1 + n);
  if (strcmp(s1, t1)) return puts("-1"), 0;
  int now = 0, m;
  vector<int> ans;
  char *p, *q;
  while (now < n) {
    while (now < n && s[now] == t[now]) now++;
    q = s + now;
    m = n - now;
    p = t + now;
    build_fail_function(p, m);
    int j = -1, res = 0, k = -1;
    for (int i = 0; i < m; i++) {
      while (j != -1 and p[j + 1] != q[i]) j = fail[j];
      if (p[j + 1] == q[i]) j++;
      if (res < j + 1) res = j + 1, k = i;
      if (j == m - 1) j = fail[j];
    }
    int A = now, B = k + 1 - res, C = res, D = n - A - B - C;
    ans.push_back(n);
    if (A + B) ans.push_back(A + B);
    ans.push_back(n);
    if (A) ans.push_back(A);
    for (int i = 0; i < B; i++) s1[i] = q[B - 1 - i];
    s1[B] = 0;
    for (int i = 0; i < D; i++) t1[i] = q[i + k + 1];
    t1[D] = 0;
    for (int i = 0; i < C; i++) s2[i] = q[k - res + 1 + i];
    s2[C] = 0;
    for (int i = 0; i < C; i++) *q = s2[i], q++;
    for (int i = 0; i < D; i++) *q = t1[i], q++;
    for (int i = 0; i < B; i++) *q = s1[i], q++;
    now += res;
  }
  println(ans.size());
  for (int i = 0; i < ans.size(); i++) printsp(ans[i]);
  puts("");
  assert(strcmp(s, t) == 0);
  return 0;
}