#include <bits/stdc++.h>
using namespace std;
char s[100005];
int n, a[100005], ans[100005];
inline bool find() {
  int i = 1, j = n;
  while (i <= j) {
    if (a[i] == a[j]) {
      i++;
      j--;
    } else if (a[i] == a[j] + 10) {
      a[j - 1]--;
      a[j] += 10;
    } else if ((a[i] == a[j] + 1) || (a[i] == a[j] + 11)) {
      a[i]--;
      a[i + 1] += 10;
    } else
      return false;
  }
  if ((i - 1 == j + 1) &&
      ((a[i - 1] > 18) || (a[i - 1] < 0) || (a[i - 1] % 2 == 1)))
    return false;
  if (a[1] == 0) return false;
  i--;
  j++;
  while (i) {
    if ((a[i] > 18) || (a[i] < 0)) return false;
    ans[i] = (a[i] + 1) / 2;
    ans[j] = a[i] - ans[i];
    i--;
    j++;
  }
  for (int i = 1; i <= n; i++) printf("%d", ans[i]);
  printf("\n");
  return true;
}
int main() {
  scanf("%s", s + 1);
  for (int i = 1; i <= strlen(s + 1); i++) a[i] = s[i] - '0';
  n = strlen(s + 1);
  if (find()) return 0;
  if ((s[1] != '1') || (n == 1)) {
    printf("0\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) a[i - 1] = s[i] - '0';
  a[1] += 10;
  n--;
  if (find()) return 0;
  printf("0\n");
  return 0;
}
