#include <bits/stdc++.h>
using namespace std;
const int mxn = 100006;
int n;
char s[mxn];
int a[mxn];
int b[mxn];
int b_[mxn];
int ans[mxn];
bool cal(int l_, int r_) {
  for (int i = 0; i < n; ++i) a[i] = s[n - 1 - i] - '0';
  fill(b, b + n, 0);
  auto carry = [](int x) {
    if (a[x] < 0) {
      a[x] += 10;
      --a[x + 1];
    }
  };
  int l, r;
  for (l = l_, r = r_; l < r; ++l, --r) {
    int vr = a[r + 1] * 10 + a[r];
    int vl = a[l];
    if (vr - vl >= 10) {
      vl += 10;
      b[l] = b[r] = vl;
      a[r] -= vl;
      a[l] -= vl;
      carry(l);
      carry(r);
    } else {
      b[l] = b[r] = vl;
      a[r] -= vl;
      a[l] -= vl;
      carry(l);
      carry(r);
    }
  }
  if (l == r) {
    b[l] = a[l + 1] * 10 + a[l];
    ({
      if (!(b[l] % 2 == 0)) return false;
    });
  }
  copy(b, b + n, b_);
  for (int i = 0; i < n; ++i) {
    b_[i + 1] += b_[i] / 10;
    b_[i] %= 10;
  }
  for (int i = 0; i < n; ++i) a[i] = s[n - 1 - i] - '0';
  ({
    if (!(equal(a, a + n, b_))) return false;
  });
  for (int i = 0; i < n; ++i) {
    ({
      if (!(b[i] <= 18)) return false;
    });
    ({
      if (!(b[i] >= 0)) return false;
    });
  }
  ({
    if (!(b[r_] > 0)) return false;
  });
  for (l = l_, r = r_; l <= r; ++l, --r) {
    ans[r] = b[r] + 1 >> 1;
    ans[l] = b[r] >> 1;
  }
  for (int i = r_; i >= l_; --i) printf("%d", ans[i]);
  printf("\n");
  return true;
}
void EXEC() {
  scanf("%s", s);
  n = strlen(s);
  if (n > 1 && s[0] == '1')
    if (cal(0, n - 2)) return;
  if (cal(0, n - 1)) return;
  printf("0\n");
}
int main() {
  EXEC();
  return 0;
}
