#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char s[N], out[N];
int a[N];
bool solve(int n) {
  for (int l = 0, r = n - 1; l <= r; l++, r--) {
    if (a[l] >= a[r] + 10) {
      a[r - 1]--;
      a[r] += 10;
    }
    if (a[l] == a[r] + 1) {
      a[l]--;
      a[l + 1] += 10;
    }
    if (a[l] != a[r]) return false;
    int tmp = (a[l] + 1) / 2;
    out[l] = tmp + '0';
    out[r] = a[l] - tmp + '0';
  }
  if (a[0] == 0) return false;
  if ((n & 1) && (a[n / 2] & 1)) return false;
  for (int i = 0; i < n; i++) {
    if (a[i] < 0 || a[i] > 18) return false;
  }
  out[n] = '\0';
  puts(out);
  return true;
}
int main() {
  while (gets(s)) {
    int n = strlen(s);
    for (int i = 0; i < n; i++) a[i] = s[i] - '0';
    if (solve(n)) continue;
    if (s[0] == '1' && n != 1) {
      for (int i = 1; i < n; i++) a[i - 1] = s[i] - '0';
      a[0] += 10;
      if (solve(n - 1)) continue;
    }
    puts("0");
  }
  return 0;
}
