#include <bits/stdc++.h>
using namespace std;
int i, j, n, q;
char c;
string x, s, b;
int main() {
  cin >> x;
  int n = x.size();
  for (i = 0; i <= n; i++) {
    for (c = 'a'; c <= 'z'; c++) {
      string s;
      for (int j = 0; j < i; j++) s += x[j];
      s += c;
      for (int j = i; j < n; j++) s += x[j];
      b = s;
      reverse(b.begin(), b.end());
      if (b == s) {
        cout << s;
        q = 1;
        break;
      }
    }
    if (q == 1) break;
  }
  if (q == 0) cout << "NA";
  return 0;
}
