#include <bits/stdc++.h>
using namespace std;
string str;
int main() {
  cin >> str;
  for (int i = 0; i <= str.size(); i++) {
    for (char j = 'a'; j <= 'z'; j++) {
      string tmp = str;
      tmp.insert(tmp.begin() + i, j);
      string tm = tmp;
      reverse(tm.begin(), tm.end());
      if (tm == tmp) {
        cout << tm << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
}
