#include <bits/stdc++.h>
using namespace std;
void sp(char &a, char &b) {
  char temp = a;
  a = b;
  b = temp;
}
bool solve(string str) {
  string temp = str;
  int l = 0, r = str.size() - 1;
  while (l < r) sp(temp[l++], temp[r--]);
  return str == temp;
}
int main() {
  string str;
  cin >> str;
  string temp;
  int sLen = str.size();
  for (char i = 'a'; i <= 'z'; i++) {
    for (int j = 0; j <= sLen; j++) {
      temp = str;
      temp.insert(j, 1, i);
      if (solve(temp)) {
        cout << temp << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
