#include <bits/stdc++.h>
using namespace std;
template <class T>
typename T::value_type arr_sum(const T& v, int n) {
  typename T::value_type sum = 0;
  for (int i = (0); i < (n); ++i) sum += v[i];
  return sum;
}
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
int main() {
  string s;
  cin >> s;
  for (int i = (0); i < (s.size() + 1); ++i) {
    for (int j = ('a'); j < ('z' + 1); ++j) {
      string s1 = s;
      s1.insert(s1.begin() + i, j);
      string s2 = s1;
      reverse(s2.begin(), s2.end());
      if (s2 == s1) {
        cout << s1;
        return 0;
      }
    }
  }
  cout << "NA";
}
