#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
char s[maxn];
int dig[maxn], l, r, R;
void tn(int x) {
  dig[x - 1]--;
  dig[x] += 10;
}
void solve() {
  scanf("%s", s + 1);
  l = 1, R = r = strlen(s + 1);
  for (int i = l; i <= r; ++i) {
    dig[i] = s[i] - '0';
  }
  if (dig[l] != dig[r]) {
    tn(l + 1);
    if (!dig[l]) ++l;
  }
  for (; l <= r; ++l, --r) {
    if (dig[l] != dig[r]) {
      if (dig[l] - dig[r] >= 10 && dig[r] < 10) tn(r);
      if (dig[l] == dig[r] + 1) tn(l + 1);
    }
    if (dig[l] != dig[r]) {
      puts("0");
      return;
    }
    if (l != r) {
      dig[r] >>= 1;
      dig[l] -= dig[r];
    } else {
      if (dig[r] & 1) {
        puts("0");
        return;
      } else
        dig[r] >>= 1;
    }
    if (dig[l] < 0 || dig[l] > 9 || dig[r] < 0 || dig[r] > 9) {
      puts("0");
      return;
    }
  }
  int tp = 0;
  for (; dig[tp] == 0; ++tp)
    ;
  for (; tp <= R; ++tp) {
    printf("%d", dig[tp]);
  }
}
int main() {
  solve();
  return 0;
}
