#include <bits/stdc++.h>
using namespace std;
int n, arr[100010], ans[100010];
char aa[100010];
bool run(int *abb) {
  int beg = 1, end = n;
  while (beg < end) {
    if (abb[beg] < 0) return false;
    if (abb[end] < 0) {
      if (abb[end] == -1) {
        abb[end - 1] -= 1;
        abb[end] += 10;
      } else
        return false;
    }
    if (abb[beg] != abb[end]) {
      if (abb[beg] == 10 && abb[end] == 9) {
        abb[beg] -= 1;
        abb[beg + 1] += 10;
        if (abb[beg] != abb[end]) return false;
        ++beg;
        --end;
        continue;
      }
      if (abb[beg] > 9) {
        abb[end] += 10;
        abb[end - 1] -= 1;
      }
      if (abb[beg] - 1 == abb[end]) {
        --abb[beg];
        abb[beg + 1] += 10;
      }
      if (abb[beg] != abb[end]) return false;
    }
    ++beg;
    --end;
  }
  if (n % 2) {
    int mid = n / 2 + 1;
    if (abb[mid] < 0 || abb[mid] % 2) return false;
    ans[mid] = abb[mid] / 2;
  }
  beg = 1, end = n;
  while (beg < end) {
    if (abb[beg] > 18) return false;
    if (abb[beg] < 10) {
      ans[beg] = abb[beg];
      ans[end] = 0;
    } else {
      ans[beg] = 9;
      ans[end] = abb[beg] - 9;
    }
    ++beg;
    --end;
  }
  if (ans[1] < 1) return false;
  for (int i = 1; i <= n; ++i) printf("%d", ans[i]);
  return true;
}
void init() {
  cin >> aa;
  n = strlen(aa);
  for (int i = 1; i <= n; ++i) arr[i] = aa[i - 1] - 48;
  if (!run(arr)) {
    for (int i = 1; i <= n; ++i) arr[i] = aa[i - 1] - 48;
    arr[1] -= 1;
    arr[2] += 10;
    --n;
    if (n < 1 || arr[1] || (!run(arr + 1))) printf("0");
  }
}
int main() {
  init();
  return 0;
}
