#include <bits/stdc++.h>
using namespace std;
string num;
int n[100 * 1000 + 100], l, r;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> num;
  for (int i = 0; i < num.size(); ++i) n[i] = num[i] - '0';
  l = 0, r = num.size() - 1;
  if (n[l] != n[r]) {
    n[l]--;
    n[l + 1] += 10;
    if (!n[l]) l++;
  }
  while (l <= r) {
    if (n[l] != n[r]) {
      if (n[l] - n[r] >= 10 && n[r] < 10) {
        n[r - 1]--;
        n[r] += 10;
      }
      if (n[l] != n[r]) {
        n[l] -= 1;
        n[l + 1] += 10;
      }
    }
    if (n[l] != n[r]) break;
    if (l < r) {
      n[l] = (n[l] + 1) / 2;
      n[r] -= n[l];
    } else {
      if (n[l] % 2)
        break;
      else
        n[l] /= 2;
    }
    if (n[r] > 9 || n[l] > 9 || n[l] < 0 || n[r] < 0) break;
    l++, r--;
  }
  if (l <= r)
    cout << "0\n";
  else {
    if (n[0]) cout << n[0];
    for (int i = 1; i < num.size(); ++i) cout << n[i];
  }
  return 0;
}
