#include <bits/stdc++.h>
using namespace std;
const int maxn = 111111;
char str[maxn], ans[maxn];
char sol[2][2][maxn];
int first;
pair<int, int> last[2][2][maxn];
bool solve(int l, int r, bool flg1, bool flg2) {
  if (l > r) return flg1 == flg2;
  if (sol[flg1][flg2][l] > 0) return true;
  if (sol[flg1][flg2][l] < 0) return false;
  for (int i = (l == first) ? 1 : 0; i <= 9; i++) {
    if (i + 1 > str[l] - '0' + 10 * flg1) break;
    int j = (str[l] - '0' + 10 * flg1 - (i + 1));
    if (l == r && i != j) continue;
    if (j >= 10) continue;
    if ((i + j + flg2) % 10 == str[r] - '0') {
      bool t = (i + j + flg2) >= 10;
      if (l == r || solve(l + 1, r - 1, 1, t)) {
        sol[flg1][flg2][l] = i + '0';
        sol[flg1][flg2][r] = j + '0';
        last[flg1][flg2][l] = make_pair(1, t);
        return true;
      }
    }
  }
  for (int i = (l == first) ? 1 : 0; i <= 9; i++) {
    if (i > str[l] - '0' + 10 * flg1) break;
    int j = (str[l] - '0' + 10 * flg1 - i);
    if (l == r && i != j) continue;
    if (j >= 10) continue;
    if ((i + j + flg2) % 10 == str[r] - '0') {
      bool t = (i + j + flg2) >= 10;
      if (l == r || solve(l + 1, r - 1, 0, t)) {
        sol[flg1][flg2][l] = i + '0';
        sol[flg1][flg2][r] = j + '0';
        last[flg1][flg2][l] = make_pair(0, t);
        return true;
      }
    }
  }
  sol[flg1][flg2][l] = -1;
  return false;
}
int main() {
  scanf("%s", str);
  int len = strlen(str);
  first = 0;
  if (solve(0, len - 1, 0, 0)) {
    int l = 0, r = len - 1;
    pair<int, int> now = make_pair(0, 0);
    while (l <= r) {
      ans[l] = sol[now.first][now.second][l];
      ans[r] = sol[now.first][now.second][r];
      now = last[now.first][now.second][l];
      l++;
      r--;
    }
    printf("%s\n", ans);
  } else if (str[0] == '1') {
    memset(sol, 0, sizeof(sol));
    first = 1;
    if (solve(1, len - 1, 1, 0)) {
      int l = 1, r = len - 1;
      pair<int, int> now = make_pair(1, 0);
      while (l <= r) {
        ans[l] = sol[now.first][now.second][l];
        ans[r] = sol[now.first][now.second][r];
        now = last[now.first][now.second][l];
        l++;
        r--;
      }
      printf("%s\n", ans + 1);
    } else {
      printf("0\n");
    }
  } else {
    printf("0\n");
  }
  return 0;
}
