#include <bits/stdc++.h>
using namespace std;
bool is_palindrome(string& s) {
  int start = 0, end = s.size() - 1;
  bool a = false;
  for (;;) {
    if (start >= end) {
      a = true;
      break;
    }
    if (s[start] == s[end]) {
      start++;
      end--;
    } else if (s[start] != s[end]) {
      break;
    }
  }
  return a;
}
int main() {
  string s, t;
  cin >> s;
  char tt = 'a';
  for (int i = 0; i < (int)s.size(); i++) {
    t = s;
    t.insert(i, 1, tt);
    for (int j = 0; j < 26; j++) {
      t[i] += j;
      if (is_palindrome(t)) {
        cout << t;
        return 0;
      }
      t[i] -= j;
    }
  }
  s += 'a';
  for (int i = 0; i < 26; i++) {
    s[s.size() - 1] += i;
    if (is_palindrome(s)) {
      cout << s;
      return 0;
    }
    s[s.size() - 1] -= i;
  }
  cout << "NA";
}
