#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
char s[maxn], a[maxn];
bool slv(int i, int j, int l, int r) {
  if (i > j) return l == r;
  s[i] += 10 * l, s[j] -= r;
  if (s[i] - s[j] > 9)
    s[j] += 10, r = 1;
  else
    r = 0;
  if (s[i] > s[j])
    s[i]--, l = 1;
  else
    l = 0;
  if (s[i] != s[j]) return 0;
  a[i] = (s[i] + 1) / 2;
  a[j] = s[i] / 2;
  if (s[i] > 18 || a[i] + a[j] != s[i]) return 0;
  return slv(i + 1, j - 1, l, r);
}
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) s[i] -= '0';
  int i = 0, j = n - 1, l = 0, r = 0;
  if (s[i] == 1 && s[j] != s[i]) i++, l = 1;
  if (!slv(i, j, l, r))
    puts("0");
  else {
    for (; i < n; i++) printf("%d", a[i]);
    puts("");
  }
  return 0;
}
