#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  long long n = str.size();
  for (long long i = 0; i <= n; i++) {
    for (long long j = 'a'; j <= 'z'; j++) {
      string t = str.substr(0, i) + string(1, j) + str.substr(i);
      string u = t;
      reverse(u.begin(), u.end());
      if (u == t) {
        cout << t << "\n";
        goto end;
      }
    }
  }
  cout << "NA"
       << "\n";
end:;
  return 0;
}
