#include <bits/stdc++.h>
using namespace std;
int al[1100000];
int r[1100000];
int n;
void printSolution() {
  for (int i = 0; i < n; i++) {
    printf("%c", (char)(r[i] + '0'));
  }
  printf("\n");
}
bool weirdAssFunctionWhatTheFuck() {
  for (int i = 0; i < n / 2; i++) {
    while (al[i] != al[n - 1 - i]) {
      if (al[i] == al[n - 1 - i] + 1 || al[i] == al[n - 1 - i] + 11) {
        al[i]--;
        al[i + 1] += 10;
      } else if (al[i] == al[n - 1 - i] + 10) {
        al[n - 1 - i] += 10;
        al[n - 1 - i - 1]--;
      } else {
        return false;
      }
    }
    r[n - 1 - i] = al[i] / 2;
    r[i] = (al[i]) - r[n - 1 - i];
  }
  if (r[0] == 0) return false;
  if (n % 2 == 1) {
    if (al[n / 2] % 2 == 1 || al[n / 2] < 0 || al[n / 2] >= 19) return false;
    r[n / 2] = al[n / 2] / 2;
  }
  for (int i = 0; i < n; i++) {
    if (al[i] < 0 || al[i] >= 19) return false;
  }
  return true;
}
void run() {
  string s;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) al[i] = s[i] - '0';
  if (n == 1) {
    if (al[0] % 2 == 1)
      printf("0\n");
    else
      printf("%d\n", al[0] / 2);
  } else if (weirdAssFunctionWhatTheFuck()) {
    printSolution();
  } else {
    for (int i = 0; i < n; i++) al[i] = 0;
    al[0] = 10 * (s[0] - '0');
    for (int i = 0; i < n - 1; i++) {
      al[i] += s[i + 1] - '0';
    }
    n--;
    if (weirdAssFunctionWhatTheFuck()) {
      printSolution();
    } else {
      printf("0\n");
    }
  }
}
int main() {
  cout << fixed << setprecision(16);
  run();
  return 0;
}
