#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int maxn = 100000 + 5;
const long double eps = 1e-6;
long double PI = acos((long double)(-1));
char s[maxn];
int l, r, sz;
int main() {
  while (scanf("%c", &s[++sz]) == 1 && isdigit(s[sz])) s[sz] -= '0';
  l = 1, r = --sz;
  if (s[l] != s[r]) {
    s[l]--;
    s[l + 1] += 10;
    if (s[l] == 0) l++;
  }
  while (l <= r) {
    if (s[l] != s[r]) {
      if ((s[l] - s[r] >= 10) && (s[r] < 10)) {
        s[r - 1]--;
        s[r] += 10;
      }
      if (s[l] - s[r] == 1) {
        s[l]--;
        s[l + 1] += 10;
      }
    }
    if (s[l] != s[r]) break;
    if (l != r) {
      s[l] = s[l] - (s[r] >> 1);
      s[r] >>= 1;
    } else {
      if (((s[l] >> 1) << 1) == s[l])
        s[l] >>= 1;
      else
        break;
    }
    if (s[l] > 9 || s[l] < 0 || s[r] > 9 || s[r] < 0) break;
    l++, r--;
  }
  if (l <= r)
    putchar('0');
  else {
    l = 1;
    if (s[l] == 0) l++;
    while (l <= sz) {
      printf("%d", s[l]);
      l++;
    }
  }
  return 0;
}
