#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
char s[100005];
int out[100005];
int st;
int vp[100005];
bool cal(int i, int j, int h, int t) {
  if (j < i) return h == t;
  vp[i] += 10 * h;
  vp[j] -= t;
  if (vp[i] - vp[j] > 9) {
    vp[j] += 10;
    t = 1;
  } else
    t = 0;
  if (vp[i] > vp[j]) {
    vp[i]--;
    h = 1;
  } else
    h = 0;
  if (vp[i] != vp[j]) return 0;
  if (i == j && vp[i] % 2 == 1) return 0;
  if (vp[i] < 0) return 0;
  out[i] = (vp[i] + 1) / 2;
  out[j] = vp[i] - out[i];
  if (vp[i] > 18) return 0;
  return cal(i + 1, j - 1, h, t);
}
void fmain() {
  scanf("%s", s);
  for (st = 0; s[st] == '0'; st++)
    ;
  n = strlen(s + st);
  for (int i = st; i < n; i++) vp[i] = s[i] - '0';
  bool ok = 0;
  if (vp[st] == 1 && vp[st] != vp[n - 1]) {
    ok = cal(++st, n - 1, 1, 0);
  } else {
    ok = cal(st, n - 1, 0, 0);
  }
  if (ok) {
    for (int i = st; i < n; i++) printf("%d", out[i]);
  } else
    puts("0");
}
int main() {
  fmain();
  return 0;
}
