#include <bits/stdc++.h>
using namespace std;
string str;
int main() {
  cin >> str;
  bool chk = false;
  for (int i = 0; i <= str.length(); i++) {
    for (char ch = 'a'; ch <= 'z'; ch++) {
      string temp1 = str.substr(0, i) + ch + str.substr(i);
      string temp2 = temp1;
      reverse(temp2.begin(), temp2.end());
      if (temp1.compare(temp2) == 0) {
        cout << temp1 << endl;
        chk = true;
        break;
      }
    }
    if (chk == true) {
      break;
    }
  }
  if (chk == false) {
    cout << "NA\n";
  }
  return 0;
}
