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