#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  for (int l = 0; l <= s.length(); ++l) {
    for (int i = 0; i < 26; ++i) {
      string r1 = s.substr(0, l) + string(1, (char)('a' + i)) +
                  s.substr(l, s.length() - l);
      string r2(r1.rbegin(), r1.rend());
      if (r1 == r2) {
        cout << r1 << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
