#include <bits/stdc++.h>
char __input[100001];
int N, a[100002];
bool Try() {
  static int w[100002];
  std::copy(a + 1, a + N + 1, w + 1);
  int L = 1, R = N;
  while (L < R - 1) {
    if (w[R] - w[L] == 0)
      ;
    else if (w[R] - w[L] == 10)
      w[L] += 10, w[L + 1]--;
    else if (w[R] - w[L] == 1)
      w[R]--, w[R - 1] += 10;
    else if (w[R] - w[L] == 11)
      w[L] += 10, w[L + 1]--, w[R]--, w[R - 1] += 10;
    else
      return false;
    L++, R--;
  }
  if (L < R && w[L] != w[R]) {
    w[L] += 10;
    w[R]--;
    if (w[L] != w[R]) return false;
  }
  if (w[1] == 0) return false;
  L = 1;
  R = N;
  while (L < R) {
    if (w[L] >= 19 || w[L] < 0) return false;
    if (w[L] < 10)
      w[L] = 0;
    else
      w[L] -= 9, w[R] = 9;
    L++;
    R--;
  }
  if (L == R) {
    if (w[L] & 1) return false;
    w[L] >>= 1;
  }
  for (int i = N; i; i--) putchar(w[i] + 48);
  puts("");
  return true;
}
int main() {
  scanf("%s", __input);
  while (__input[N]) N++;
  for (int i = 1; i <= N; i++) a[i] = __input[N - i] - '0';
  if (Try()) return 0;
  if (N > 1 && a[N] == 1) {
    a[N - 1] += 10;
    a[N] = 0;
    N--;
    if (Try()) return 0;
  }
  puts("0");
  return 0;
}
