#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const long long mod = 1000000000 + 7;
const double eps = 1e-6;
int n, m, x, y;
string s;
int a[maxn];
int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    a[i] = s[i] - '0';
  }
  int l = 0, r = n - 1;
  if (a[l] != a[r]) {
    a[l]--;
    a[l + 1] += 10;
    if (a[l] == 0) l++;
  }
  while (l <= r) {
    if (a[l] != a[r]) {
      if ((a[l] - a[r] >= 10) && (a[r] < 10)) {
        a[r - 1]--;
        a[r] += 10;
      }
      if (a[l] - a[r] == 1) {
        a[l]--;
        a[l + 1] += 10;
      }
    }
    if (a[l] != a[r]) break;
    if (l != r) {
      a[l] = a[l] - (a[r] >> 1);
      a[r] >>= 1;
    } else {
      if (((a[l] >> 1) << 1) == a[l])
        a[l] >>= 1;
      else
        break;
    }
    if (a[l] > 9 || a[l] < 0 || a[r] > 9 || a[r] < 0) break;
    l++, r--;
  }
  if (l <= r) {
    cout << 0 << endl;
    return 0;
  }
  l = 0;
  while (a[l] == 0) l++;
  while (l < n) {
    cout << a[l];
    l++;
  }
  cout << endl;
  return 0;
}
