#include <bits/stdc++.h>
using namespace std;
char s[20];
bool check(int j) {
  bool ans = true;
  for (int i = 0; i <= j; i++, j--) {
    if (s[i] != s[j]) {
      ans = false;
    }
  }
  return ans;
}
int main() {
  bool ok = false;
  cin >> s;
  int n = strlen(s);
  for (int i = n; i > -1; i--) {
    s[i] = s[n - i];
    if (check(n)) {
      ok = true;
      break;
    }
    if (i > 0) s[i] = s[i - 1];
  }
  if (ok) {
    for (int i = 0; i <= n; i++) cout << s[i];
  } else
    cout << "NA";
  return 0;
}
