#include <bits/stdc++.h>
using namespace std;
char str1[100013], str2[100013], ans[100013];
int N;
bool over(char s[], int i, int mi) {
  while (i >= mi) {
    if (s[i]) {
      s[i]--;
      return false;
    }
    s[i] = 9;
    i--;
  }
  return true;
}
bool solve(char s[], int k, bool ex) {
  if (k * 2 >= N) {
    return !ex;
  }
  if (k * 2 + 1 == N) {
    if (ex) {
      s[k] += 10;
    }
    if (s[k] & 1) {
      return false;
    }
    ans[k] = s[k] >> 1;
    return true;
  }
  if (s[k] == s[N - k - 1]) {
    if (ex) {
      s[k] += 10;
    }
    if (s[k] == 19) {
      return false;
    }
    ans[k] = (s[k] + 1) >> 1;
    ans[N - k - 1] = s[k] >> 1;
    s[k] = 0;
    if (ex && over(s, N - k - 2, k)) {
      return false;
    }
    return solve(s, k + 1, s[k]);
  } else if (s[k] == s[N - k - 1] + 1 || s[k] == 0 && ex && s[N - k - 1] == 9) {
    if (ex) {
      s[k] += 10;
    }
    s[k] -= 1;
    ans[k] = (s[k] + 1) >> 1;
    ans[N - k - 1] = s[k] >> 1;
    s[k] = 1;
    if (ans[k] + ans[N - k - 1] >= 10 && over(s, N - k - 2, k)) {
      return false;
    }
    return solve(s, k + 1, s[k]);
  }
  return false;
}
int main() {
  scanf("%s", str1);
  N = strlen(str1);
  for (int i = 0; i < N; i++) {
    str1[i] -= '0';
  }
  memcpy(str2, str1, N);
  if (str1[N - 1] && solve(str1, 0, false)) {
    for (int i = 0; i < N; i++) {
      ans[i] += '0';
    }
    ans[N] = 0;
    int k = 0;
    while (ans[k] == '0') {
      k++;
    }
    printf("%s\n", ans + k);
  } else if (str2[0] == 1) {
    N--;
    if (solve(str2 + 1, 0, true)) {
      for (int i = 0; i < N; i++) {
        ans[i] += '0';
      }
      ans[N] = 0;
      int k = 0;
      while (ans[k] == '0') {
        k++;
      }
      printf("%s\n", ans + k);
    } else {
      printf("0\n");
    }
  } else {
    printf("0\n");
  }
  return 0;
}
