#include <bits/stdc++.h>
using namespace std;
const int N = 111111;
string str;
char ans_str[N];
bool dfs(int l, int r, int c1, int c2) {
  if (l > r) {
    if (l - r == 1) return c1 == c2;
    return true;
  }
  int a = str[l] - '0' + c1 * 10;
  int b = str[r] - '0' - c2;
  int nc1 = 0, nc2 = 0;
  if (a - b >= 10) {
    b += 10;
    nc2 = 1;
  }
  if (a > b) {
    a--;
    nc1 = 1;
  }
  if (a != b || !(a >= 0 && a <= 18)) return false;
  if (l == r && a % 2 == 1) return false;
  ans_str[l] = (a + 1) / 2 + '0';
  ans_str[r] = a / 2 + '0';
  return dfs(l + 1, r - 1, nc1, nc2);
}
int main() {
  cin >> str;
  int n = str.length();
  bool ret = dfs(0, n - 1, 0, 0);
  ans_str[n] = 0;
  if ((!ret || ans_str[0] == '0') && str[0] == '1' && n > 1) {
    n--;
    str = str.substr(1, n);
    ret = dfs(0, n - 1, 1, 0);
    ans_str[n] = 0;
  }
  if (!ret) {
    cout << "0" << endl;
  } else {
    cout << ans_str << endl;
  }
  return 0;
}
