#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const long long X = 316;
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
string s;
int f[N], a[N];
bool solve(int i, int j, int l, int r) {
  int newl, newr;
  if (i > j) return l == r;
  if (i == j) {
    int w = f[i] - r + 10 * l;
    if (w % 2 == 1 || w > 18 || w < 0) return 0;
    a[i] = w / 2;
    return 1;
  }
  int x = f[i] + 10 * l;
  int y = f[j] - r;
  if (x - y > 9)
    y += 10, newr = 1;
  else
    newr = 0;
  if (x > y)
    x -= 1, newl = 1;
  else
    newl = 0;
  if (x != y || x > 18 || x < 0) return 0;
  a[i] = min(9, x);
  a[j] = x - a[i];
  return solve(i + 1, j - 1, newl, newr);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  string s;
  cin >> s;
  int n = s.size();
  for (long long i = 0; i <= n - 1; i++) {
    f[i] = s[i] - 48;
  }
  int i = 0, j = n - 1, l = 0, r = 0;
  if (f[i] == 1 && f[j] != f[i]) i = 1, l = 1;
  if (!solve(i, j, l, r))
    cout << 0 << "\n";
  else {
    for (long long w = i; w <= n - 1; w++) cout << a[w];
  }
}
