#include <bits/stdc++.h>
using namespace std;
vector<int> n;
vector<int> ans;
int offset = 0;
int dp[100001][2][2];
bool f(int id, bool l, bool r) {
  if (dp[id][l][r]) return false;
  int ltarget = n[id + offset];
  int rtarget = n[n.size() - id - 1];
  int len = n.size() - offset;
  int last = (len % 2) ? len / 2 : (len / 2 - 1);
  if (id == last) {
    if (len % 2 == 0) {
      for (int i = 9; i >= 0; i--) {
        for (int j = 0; j < 10; j++) {
          int rsum = i + j + r;
          int lsum = i + j + rsum / 10;
          if (lsum >= 10 != l) continue;
          if (rsum % 10 != rtarget) continue;
          if (lsum % 10 != ltarget) continue;
          ans[id] = i;
          ans[id + 1] = j;
          return true;
        }
      }
    } else {
      for (int i = 0; i < 10; i++) {
        int sum = i + i + r;
        if (sum >= 10 != l) continue;
        if (sum % 10 != rtarget) continue;
        ans[id] = i;
        return true;
      }
    }
  }
  for (int i = 9; i >= (id == 0 ? 1 : 0); i--)
    for (int j = 0; j < 10; j++) {
      for (int nl = 0; nl < 2; nl++) {
        int lsum = i + j + nl;
        int rsum = i + j + r;
        if (rsum % 10 != rtarget) continue;
        if (lsum >= 10 != l) continue;
        if (lsum % 10 != ltarget) continue;
        bool nr = rsum >= 10;
        if (f(id + 1, nl, nr)) {
          ans[id] = i;
          ans[ans.size() - id - 1] = j;
          return true;
        }
      }
    }
  return !(dp[id][l][r] = 1);
}
bool w(bool a) {
  if (!a) return false;
  for (int i = 0; i < ans.size(); i++) cout << ans[i];
  cout << endl;
  return true;
}
int main() {
  string st;
  cin >> st;
  for (int i = 0; i < st.size(); i++) n.push_back(st[i] - '0');
  ans.resize(n.size(), -1);
  memset(dp, 0, sizeof(dp));
  if (w(f(0, 0, 0))) return 0;
  ans.resize(n.size() - 1, -1);
  memset(dp, 0, sizeof(dp));
  if (n.size() > 1 && n[0] == 1) {
    offset = 1;
    if (w(f(0, 1, 0))) return 0;
  }
  cout << 0 << endl;
}
