#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
const int maxn = 101000;
string S;
int ans[maxn];
bool spe;
int le;
void solve(string S, bool tp) {
  bool lc, rc;
  lc = tp;
  rc = false;
  bool temp = false;
  for (int i = 0; i < S.length(); i++) {
    int j = S.length() - i - 1;
    if (i > j) {
      if (lc == rc)
        temp = true;
      else
        temp = false;
      break;
    }
    if (i == j) {
      int t = S[i] - '0';
      if (rc) t -= 1;
      if (lc) t += 10;
      if (t % 2 == 1 || t < 0) break;
      ans[j] = t / 2;
      temp = true;
      break;
    }
    int lnum = S[i] - '0';
    int rnum = S[j] - '0';
    if (!lc && !rc) {
      if (rnum == lnum) {
        ans[j] = 0;
        ans[i] = rnum;
      } else if (rnum + 1 == lnum) {
        ans[i] = rnum;
        ans[j] = 0;
        lc = true;
      } else {
        break;
      }
    } else if (!lc && rc) {
      rnum = (rnum + 9) % 10;
      if (rnum + 1 == lnum) {
        lc = true;
        ans[i] = rnum;
        ans[j] = 0;
      } else if (rnum == lnum) {
        ans[i] = rnum;
        ans[j] = 0;
        lc = false;
      } else
        break;
      rc = false;
      if (rnum == 9) rc = true;
    } else if (lc && rc) {
      if (lnum == rnum) {
        ans[i] = rnum;
        ans[j] = 9;
      } else if (lnum + 1 == rnum) {
        ans[i] = rnum;
        ans[j] = 9;
        lc = false;
      } else
        break;
    } else {
      lnum += 10;
      if (lnum % 10 == rnum % 10) {
        if (rnum == 9) break;
        ans[i] = (rnum + 1) % 10;
        ans[j] = 9;
        lc = false;
        rc = true;
      } else if (lnum % 10 == (rnum + 1) % 10) {
        lnum = lnum - 1;
        ans[i] = lnum - 9;
        ans[j] = 9;
        rc = true;
        lc = true;
        if (lnum < 10) rc = false;
      } else
        break;
    }
  }
  if (ans[0] == 0) temp = false;
  spe = temp;
  if (spe) le = S.length();
}
int main() {
  cin >> S;
  solve(S, false);
  if (!spe && S[0] == '1') solve(S.substr(1), true);
  if (spe) {
    for (int i = 0; i < le; i++) cout << ans[i];
    cout << endl;
  } else
    cout << "0" << endl;
  return 0;
}
