#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s, temp, str;
  int l, i, j, k, f, len, c;
  cin >> s;
  l = s.length();
  for (i = 0; i <= l; i++) {
    for (j = 97; j <= 122; j++) {
      str = s;
      f = c = 0;
      temp = (char)(j);
      str.insert(i, temp);
      len = str.length();
      for (k = 0; k < len / 2; k++) {
        if (str[k] != str[len - k - 1]) {
          f = 1;
          break;
        }
      }
      if (f == 0) break;
    }
    if (f == 0) break;
  }
  if (!f)
    cout << str << "\n";
  else
    cout << "NA\n";
  return 0;
}
