#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:268435456")
using namespace std;
template <typename T>
inline T abs(T a) {
  return ((a < 0) ? -a : a);
}
template <typename T>
inline T sqr(T a) {
  return a * a;
}
template <class T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sign(T a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int dxK[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dyK[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dxKn[] = {-2, -1, 1, 2, 2, 1, -1, -2};
const int dyKn[] = {1, 2, 2, 1, -1, -2, -2, -1};
const int N = int(1e6) + 9;
const int M = int(2e2) + 9;
const int LOGN = 22;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = 1e9 + 100;
const long long INF64 = 2e18;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-9;
int n;
int dd;
string s;
int a[N];
int dp[N][2][2];
pair<int, int> p[N][2][2];
pair<int, int> to[N][2][2];
int go(int len, bool mustl, bool dr) {
  int &res = dp[len][mustl][dr];
  if (res != -1) return res;
  res = 0;
  int l = len, r = n - dd - len;
  if (l > r) return res = 1;
  if (l == r) {
    for (int i = 0; i < (int)(10); ++i) {
      if ((i + i + dr) % 10 == a[l])
        if ((i + i + dr) / 10 == mustl) {
          to[len][mustl][dr] = make_pair(i, i);
          return res = 1;
        }
    }
    return res;
  }
  for (int i = 0; i < (int)(10); ++i)
    for (int j = 0; j < (int)(10); ++j)
      for (int nmustl = 0; nmustl < (int)(2); ++nmustl) {
        if (len + i == 0) continue;
        bool ndr = ((i + j + dr) / 10) > 0;
        if ((i + j + dr) % 10 != a[r]) continue;
        if ((i + j + nmustl) % 10 != a[l]) continue;
        if ((i + j + nmustl) / 10 != mustl) continue;
        if (l == r - 1 && nmustl != ndr) continue;
        if (go(len + 1, nmustl, ndr)) {
          p[len][mustl][dr] = make_pair(nmustl, ndr);
          to[len][mustl][dr] = make_pair(i, j);
          return res = 1;
        }
      }
  return res;
}
void solve() {
  cin >> s;
  n = (int)(s.size());
  for (int i = 0; i < (int)(n); ++i) a[i] = s[i] - '0';
  memset(dp, -1, sizeof dp);
  dd = 1;
  go(0, 0, 0);
  if (dp[0][0][0] == 1) {
    pair<int, int> cur = make_pair(0, 0);
    int pos = 0, l = 0, r = n - 1;
    while (l <= r) {
      pair<int, int> ncur = p[pos][cur.first][cur.second];
      a[l] = to[pos][cur.first][cur.second].first,
      a[r] = to[pos][cur.first][cur.second].second;
      ++l, --r, ++pos;
      cur = ncur;
    }
    for (int i = 0; i < (int)(n); ++i) cout << a[i];
    return;
  }
  memset(dp, -1, sizeof dp);
  dd = 0;
  go(1, 1, 0);
  if (a[0] == 1 && n > 1 && dp[1][1][0] == 1) {
    pair<int, int> cur = make_pair(1, 0);
    int pos = 1, l = 1, r = n - 1;
    while (l <= r) {
      pair<int, int> ncur = p[pos][cur.first][cur.second];
      a[l] = to[pos][cur.first][cur.second].first,
      a[r] = to[pos][cur.first][cur.second].second;
      ++l, --r, ++pos;
      cur = ncur;
    }
    for (int i = 1; i < (int)(n); ++i) cout << a[i];
    return;
  }
  cout << 0;
}
int main() {
  srand(time(NULL));
  srand(time(NULL));
  cout << setprecision(10) << fixed;
  cerr << setprecision(10) << fixed;
  solve();
  return 0;
}
