#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ss, cc;
  cin >> s;
  for (int i = 0; i <= s.length(); i++) {
    for (char ch = 'a'; ch <= 'z'; ch++) {
      ss = s;
      cc = ch;
      ss.insert(i, cc);
      if (ss == string(ss.rbegin(), ss.rend())) {
        cout << ss << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
