#include <bits/stdc++.h>
using namespace std;
string qwe(char a) {
  string ret = "";
  ret += a;
  return ret;
}
bool pal(string str) {
  int n = str.size();
  for (int i = 0; i < n / 2; ++i) {
    if (str[i] != str[n - 2 - i]) return false;
  }
  return true;
}
int main() {
  string str;
  cin >> str;
  str += "\n";
  int n = str.size() - 1;
  string temp;
  for (int i = 0; i < n; ++i) {
    temp = str;
    if (i > n / 2) {
      temp.insert(i + 1, qwe((str[n - i - 1])));
    } else
      temp.insert(i, qwe((str[n - i - 1])));
    if (pal(temp)) {
      cout << temp;
      return 0;
    }
  }
  printf("NA\n");
  return 0;
}
