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