#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
char s[maxn];
int a[maxn];
int main() {
  scanf("%s", &s);
  int n = strlen(s);
  for (int i = 0; i < n; ++i) {
    a[i] = s[i] - '0';
  }
  int l = 0, r = n - 1;
  if (a[l] != a[r]) {
    a[l + 1] += 10;
    a[l]--;
    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] -= 1;
          if (a[r] < 0) break;
        } else
          a[r] = 0;
      } else {
        a[l] -= 9;
        a[r] = 9;
      }
    }
    l++;
    r--;
  }
  if (l <= r)
    printf("0\n");
  else {
    if (a[0]) printf("%d", a[0]);
    for (int i = 1; i < n; ++i) printf("%d", a[i]);
  }
  return 0;
}
