#include <bits/stdc++.h>
using namespace std;
int main() {
  string f, temp;
  cin >> f;
  int len(f.size());
  for (char c = 'a'; c <= 'z'; c++) {
    temp.clear();
    temp.push_back(c);
    for (int i = 0; i <= len; i++) {
      string spre = f.substr(0, i);
      string stail = f.substr(i, len - i);
      string s1 = spre + temp + stail;
      string s2 = s1;
      reverse(s2.begin(), s2.end());
      if (s1 == s2) {
        cout << s1 << endl;
        return 0;
      }
    }
  }
  printf("NA\n");
  return 0;
}
