#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int l = 0; l <= s.length(); l++) {
    for (char test = 'a'; test <= 'z'; test++) {
      string hi = s.substr(0, l);
      hi.push_back(test);
      hi += s.substr(l);
      string hib = hi;
      reverse(hib.begin(), hib.end());
      if (hib == hi) {
        cout << hi << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
