#include <bits/stdc++.h>
using namespace std;
char a[13];
string str;
int len;
int judge() {
  for (int i = 0; i < (len + 1) / 2; i++)
    if (a[i] != a[len - i]) return 0;
  return 1;
}
int main() {
  char ch;
  cin >> str;
  len = str.length();
  for (int i = 0; i <= len; i++) {
    for (char j = 'a'; j <= 'z'; j++) {
      for (int k = 0; k < i; k++) a[k] = str[k];
      a[i] = j;
      for (int k = i + 1; k <= len; k++) a[k] = str[k - 1];
      if (judge()) {
        for (int k = 0; k <= len; k++) cout << a[k];
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
