#include <bits/stdc++.h>
using namespace std;
char s[100010];
int a[100010];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (register int i = 0; i < len; ++i) a[i] = s[i] - '0';
  int l = 0, r = len - 1;
  if (a[l] != a[r]) {
    a[l]--;
    a[l + 1] += 10;
    if (!a[l]) ++l;
  }
  while (l <= r) {
    if (a[l] - a[r] >= 10) {
      a[r] += 10;
      --a[r - 1];
    }
    if (a[l] - a[r] == 1) {
      --a[l];
      a[l + 1] += 10;
    }
    if (a[l] != a[r] || a[l] > 18 || a[l] < 0) break;
    if (l == r) {
      if (a[l] % 2) break;
      a[l] /= 2;
    } else {
      if (a[l] < 10) {
        if (l == 0) {
          a[l] = 1;
          --a[r];
          if (a[r] < 0) break;
        } else
          a[r] = 0;
      } else {
        a[l] -= 9;
        a[r] = 9;
      }
    }
    ++l;
    --r;
  }
  if (l <= r)
    cout << 0 << endl;
  else {
    if (a[0]) cout << a[0];
    for (register int i = 1; i < len; ++i) cout << a[i];
  }
  return 0;
}
