#include <bits/stdc++.h>
using namespace std;
char s[10], a[11];
int l;
bool checkPalindrome() {
  int j = l;
  for (int i = 0; i <= l / 2; ++i) {
    if (a[i] != a[j]) return false;
    --j;
  }
  return true;
}
bool solve() {
  l = strlen(s);
  for (int i = 0; i <= l; ++i) {
    for (int j = int('a'); j <= int('z'); ++j) {
      for (int k = 0; k < l; ++k) a[k] = s[k];
      for (int k = l; k >= i + 1; --k) a[k] = a[k - 1];
      a[i] = char(j);
      if (checkPalindrome()) return true;
    }
  }
  return false;
}
int main() {
  cin.sync_with_stdio(false);
  cin.getline(s, 11);
  if (solve())
    for (int i = 0; i <= l; ++i) cout << a[i];
  else
    cout << "NA";
  return 0;
}
