#include <bits/stdc++.h>
using namespace std;
string s;
int a[100005];
int ans[100005];
bool judge(int n) {
  for (int i = 0; i < (n) / 2;) {
    if (a[i] == a[n - i - 1])
      i++;
    else if (a[i] == a[n - i - 1] + 1 || a[i] == a[n - i - 1] + 11) {
      a[i + 1] += 10;
      a[i]--;
    } else if (a[i] == a[n - i - 1] + 10) {
      a[n - i - 2]--;
      a[n - i - 1] += 10;
    } else {
      return false;
    }
  }
  if (n & 1) {
    if (a[(n) / 2] > 18 || a[(n) / 2] < 0 || a[(n) / 2] % 2 == 1) {
      return false;
    } else {
      a[(n) / 2] /= 2;
      ans[(n) / 2] = a[(n) / 2];
    }
  }
  for (int i = 0; i < (n) / 2; i++) {
    if (a[i] > 18 || a[i] < 0) {
      return false;
    }
    ans[i] = (a[i] + 1) / 2;
    ans[n - i - 1] = a[i] / 2;
  }
  if (ans[0] <= 0) {
    return false;
  }
  return true;
}
int main() {
  std::ios::sync_with_stdio(false);
  while (cin >> s) {
    int len = s.length();
    for (int i = 0; i < len; i++) {
      a[i] = s[i] - '0';
    }
    if (judge(len)) {
      for (int i = 0; i < len; i++) cout << ans[i];
      cout << endl;
    } else {
      for (int i = 0; i < len - 1; i++) a[i] = s[i + 1] - '0';
      a[0] += 10;
      if (judge(len - 1)) {
        for (int i = 0; i < len - 1; i++) cout << ans[i];
        cout << endl;
      } else {
        cout << "0" << endl;
      }
    }
  }
  return 0;
}
