#include <bits/stdc++.h>
using namespace std;
int dr[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dc[] = {1, -1, 0, 0, 1, -1, 1, -1};
bool isPalin(char *s) {
  int l = strlen(s);
  bool f = true;
  for (int i = 0; i <= l / 2; i++) {
    if (s[i] != s[l - i - 1]) {
      f = false;
      break;
    }
  }
  return f;
}
int main() {
  char s[15], t[15];
  int l, f;
  cin >> s;
  l = strlen(s);
  f = 0;
  for (int i = 0; i <= l; i++) {
    for (int j = 0; j < i; j++) {
      t[j] = s[j];
    }
    for (int j = 0; j < 26; j++) {
      t[i] = 'a' + j;
      int k;
      for (k = i; k < l; k++) {
        t[k + 1] = s[k];
      }
      t[k + 1] = '\0';
      if (isPalin(t)) {
        cout << t << "\n";
        f = 1;
        break;
      }
    }
    if (f == 1) break;
  }
  if (f == 0) cout << "NA\n";
  return 0;
}
