#include <bits/stdc++.h>
using namespace std;
bool compare(int a, int b) { return a > b; }
bool ispalindrome(string s) {
  string str;
  str = s;
  reverse(str.begin(), str.end());
  if (s == str)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  string c = "a";
  string s, str;
  cin >> s;
  int flag;
  for (int i = 0; i <= s.length(); i++) {
    flag = 0;
    for (int j = 0; j < 26; j++) {
      str = s;
      c[0] = 'a' + j;
      str.insert(i, c);
      if (ispalindrome(str)) {
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      cout << str << endl;
      break;
    }
  }
  if (flag == 0) {
    cout << "NA" << endl;
  }
  return 0;
}
