Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", and "kkkkkk" are palindromes, while strings "moon", "tv", and "abab" are not. An empty string is also a palindrome.

Gildong loves this concept so much, so he wants to play with it. He has n distinct strings of equal length m. He wants to discard some of the strings (possibly none or all) and reorder the remaining strings so that the concatenation becomes a palindrome. He also wants the palindrome to be as long as possible. Please help him find one.

Input

The first line contains two integers n and m (1 ≤ n ≤ 100, 1 ≤ m ≤ 50) — the number of strings and the length of each string.

Next n lines contain a string of length m each, consisting of lowercase Latin letters only. All strings are distinct.

Output

In the first line, print the length of the longest palindrome string you made.

In the second line, print that palindrome. If there are multiple answers, print any one of them. If the palindrome is empty, print an empty line or don't print this line at all.

Examples

Input


3 3
tab
one
bat


Output


6
tabbat


Input


4 2
oo
ox
xo
xx


Output


6
oxxxxo


Input


3 5
hello
codef
orces


Output


0



Input


9 4
abab
baba
abcd
bcde
cdef
defg
wxyz
zyxw
ijji


Output


20
ababwxyzijjizyxwbaba

Note

In the first example, "battab" is also a valid answer.

In the second example, there can be 4 different valid answers including the sample output. We are not going to provide any hints for what the others are.

In the third example, the empty string is the only valid palindrome string.
#include <bits/stdc++.h>
using namespace std;
long long powN(long long a, long long p) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2);
  z = (z * z) % 1000000007;
  if (p % 2) z = (z * a) % 1000000007;
  return z;
}
long long powN(long long a, long long p, long long md) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2, md);
  z = (z * z) % md;
  if (p % 2) z = (z * a) % md;
  return z;
}
long long modinverse(long long n, long long p) { return (powN(n, p - 2)); }
long long ncr(long long n, long long r) {
  long long p = 1000000007;
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return ((fac[n] * (modinverse(fac[r], p) % p)) % p *
          modinverse(fac[n - r], p) % p) %
         p;
}
long long int parent[200005];
long long int ssize[200005];
void make_set(int v) {
  parent[v] = v;
  ssize[v] = 1;
}
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (ssize[a] < ssize[b]) swap(a, b);
    parent[b] = a;
    ssize[a] += ssize[b];
  }
}
typedef struct Edge {
  long long int u, v, weight;
  bool operator<(Edge const& other) { return weight < other.weight; }
} edge;
int r[200005];
bool prime[200005];
void sieve(long long int n) {
  for (long long int i = 1; i <= n; ++i) prime[i] = true;
  prime[1] = prime[0] = false;
  r[1] = 1;
  for (long long int i = 2; i <= n; ++i) {
    if (prime[i]) {
      r[i] = i;
      for (long long int j = i; i * j <= n; ++j) {
        if (prime[j * i]) r[j * i] = i;
        prime[j * i] = false;
      }
    }
  }
}
void bfs(int s, vector<int> adj[], int n, int d[]) {
  queue<int> q;
  q.push(s);
  d[s] = 0;
  vector<bool> visited(n + 1, false);
  visited[s] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < int((adj[u]).size()); ++i) {
      int v = adj[u][i];
      if (!visited[v]) {
        q.push(v);
        visited[v] = true;
        d[v] = d[u] + 1;
      }
    }
  }
}
typedef struct {
  int t, C[3];
} pt;
int n;
void add(int id, long long int val, long long int BIT[]) {
  while (id <= n) {
    BIT[id] += val;
    id = id + (id & (-id));
  }
}
long long int query(int id, long long int BIT[]) {
  long long int result = 0;
  while (id > 0) {
    result += BIT[id];
    id = id - (id & (-id));
  }
  return (result);
}
int main() {
  int t = 1;
  while (t--) {
    int n, m;
    cin >> n >> m;
    string A[n + 1];
    map<string, int> mp;
    for (long long int i = 1; i <= n; ++i) {
      cin >> A[i];
    }
    vector<string> ans1, ans2;
    set<int> taken;
    for (long long int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        string p = A[i];
        string q = A[j];
        reverse(q.begin(), q.end());
        if (p == q && taken.find(j) == taken.end()) {
          ans1.push_back(p);
          reverse(q.begin(), q.end());
          ans2.push_back(q);
          taken.insert(j);
          taken.insert(i);
          break;
        }
      }
    }
    vector<string> middle;
    for (long long int i = 1; i <= n; ++i) {
      if (taken.find(i) == taken.end() && int((middle).size()) == 0) {
        string p = A[i];
        string q = A[i];
        reverse(q.begin(), q.end());
        if (p == q) {
          middle.push_back(p);
          taken.insert(i);
        }
      }
    }
    cout << int((ans1).size()) * m * 2 + int((middle).size()) * m << endl;
    reverse(ans2.begin(), ans2.end());
    for (long long int i = 0; i < int((ans1).size()); ++i) cout << ans1[i];
    for (long long int i = 0; i < int((middle).size()); ++i) cout << middle[i];
    for (long long int i = 0; i < int((ans2).size()); ++i) cout << ans2[i];
    cout << endl;
  }
}
