#include <bits/stdc++.h>
using namespace std;
bool is_pali(string s) {
  string temp = s;
  reverse(temp.begin(), temp.end());
  if (s == temp)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  char input[12], output[12];
  cin >> input;
  string s;
  int length = (int)strlen(input);
  bool ok = false;
  for (int i = 0; i <= 25 && !ok; i++) {
    memset(output, '\0', sizeof(output));
    for (int j = 0; j <= length; j++) {
      for (int k = 0, m = 0; k <= length; k++) {
        if (k == j)
          output[k] = (char)(i + 97);
        else {
          output[k] = input[m];
          m++;
        }
      }
      output[length + 1] = '\0';
      s = output;
      if (is_pali(s)) {
        cout << s << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
