#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j;
  string s, t1, t2;
  cin >> s;
  for (i = 0; i <= s.size(); i++)
    for (j = 97; j <= 123; j++) {
      t1 = s.substr(0, i) + char(j) + s.substr(i);
      t2 = t1;
      reverse(t2.begin(), t2.end());
      if (t1 == t2) {
        cout << t1;
        return 0;
      }
    }
  cout << "NA";
  return 0;
}
