#include <bits/stdc++.h>
using namespace std;
string alpha = "abcdefghijklmnopqrstuvwxyz";
bool check(string str) {
  for (int i = 0, j = str.length() - 1; i < j; i++, j--) {
    if (str[i] != str[j]) return false;
  }
  return true;
}
int main() {
  string s, s2;
  cin >> s;
  s2 = s;
  for (int i = 0; i < alpha.length(); i++) {
    for (int j = 0; j <= s.length(); j++) {
      s2.insert(j, alpha.substr(i, 1));
      if (check(s2)) {
        cout << s2;
        return 0;
      }
      s2 = s;
    }
  }
  printf("NA\n");
  return 0;
}
