#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-8;
const long long mod = 1e9 + 7;
const unsigned long long mx = 133333331;
inline void RI(int &x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
char s[100005];
int sum[100005];
char ans[100005];
int len;
bool check() {
  for (int i = 0; i < len / 2;) {
    if (sum[i] == sum[len - 1 - i])
      i++;
    else if (sum[i] == sum[len - 1 - i] + 1 ||
             sum[i] == sum[len - 1 - i] + 11) {
      sum[i]--;
      sum[i + 1] += 10;
    } else if (sum[i] == sum[len - 1 - i] + 10) {
      sum[len - 2 - i]--;
      sum[len - 1 - i] += 10;
    } else
      return false;
  }
  if (len % 2) {
    if (sum[len / 2] < 0 || sum[len / 2] > 18 || sum[len / 2] % 2 == 1)
      return false;
    ans[len / 2] = sum[len / 2] / 2 + '0';
  }
  for (int i = 0; i < len / 2; i++) {
    if (sum[i] < 0 || sum[i] > 18) return false;
    ans[i] = (sum[i] + 1) / 2 + '0';
    ans[len - 1 - i] = sum[i] / 2 + '0';
  }
  ans[len] = 0;
  return ans[0] > '0';
}
int main() {
  while (~scanf("%s", s)) {
    len = strlen(s);
    for (int i = 0; i < len; i++) sum[i] = s[i] - '0';
    if (check())
      printf("%s\n", ans);
    else if (s[0] == '1' && len > 1) {
      len--;
      for (int i = 0; i < len; i++) sum[i] = s[i + 1] - '0';
      sum[0] += 10;
      if (check())
        printf("%s\n", ans);
      else
        printf("0\n");
    } else
      printf("0\n");
  }
  return 0;
}
