#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int A[MAXN];
int n;
char c[MAXN];
void load() {
  scanf("%s", c);
  n = strlen(c);
  for (int i = 0; i < n; i++) A[i] = c[i] - '0';
}
int sol[MAXN];
bool solve() {
  bool left_greater_than_nine = false;
  bool right_plus_one = false;
  int L = 0, R = n - 1;
  int begin = 0;
  if (A[0] == 1 && A[R] != 1) {
    left_greater_than_nine = true;
    L = 1;
    begin = 1;
  }
  while (R - L > 1) {
    int a = A[L];
    int b = A[R];
    if (a == b) {
      if (a == 9 && left_greater_than_nine && !right_plus_one) return false;
      if (a == 0 && !left_greater_than_nine && right_plus_one) return false;
      int k = left_greater_than_nine * 10 + a - right_plus_one;
      if (k < 0) {
        k += 10;
      }
      sol[L] = sol[R] = k / 2;
      if (k & 1) sol[L]++;
      int t = left_greater_than_nine;
      left_greater_than_nine = right_plus_one;
      right_plus_one = t;
    } else if (a == b - 1) {
      if (!right_plus_one) return false;
      int k = left_greater_than_nine * 10 + a;
      sol[L] = sol[R] = k / 2;
      if (k & 1) sol[L]++;
      right_plus_one = left_greater_than_nine;
      left_greater_than_nine = false;
    } else if (a - 1 == b) {
      if (right_plus_one) return false;
      int k = left_greater_than_nine * 10 + b;
      sol[L] = sol[R] = k / 2;
      if (k & 1) sol[L]++;
      right_plus_one = left_greater_than_nine;
      left_greater_than_nine = true;
    } else if (a == 0 && b == 9) {
      if (right_plus_one) return false;
      if (!left_greater_than_nine) return false;
      sol[L] = 5;
      sol[R] = 4;
      left_greater_than_nine = true;
      right_plus_one = false;
    } else if (a == 9 && b == 0) {
      if (left_greater_than_nine) return false;
      if (!right_plus_one) return false;
      sol[L] = 5;
      sol[R] = 4;
      left_greater_than_nine = false;
      right_plus_one = true;
    } else {
      return false;
    }
    L++;
    R--;
  }
  if (L == R) {
    int a = A[L];
    if (a == 0 && !left_greater_than_nine && right_plus_one) return false;
    if (a == 9 && left_greater_than_nine && !right_plus_one) return false;
    int k = left_greater_than_nine * 10 + a - right_plus_one;
    if (k & 1) return false;
    sol[L] = k / 2;
  } else {
    int a = A[L], b = A[R];
    if (a == b) {
      if (left_greater_than_nine ^ right_plus_one) return false;
      int k = left_greater_than_nine * 10 + a - right_plus_one;
      sol[L] = sol[R] = k / 2;
      if (k & 1) sol[L]++;
    } else if (a == b - 1) {
      if (left_greater_than_nine || !right_plus_one) return false;
      sol[L] = sol[R] = a / 2;
      if (a & 1) sol[R]++;
    } else if (b == a - 1) {
      if (!left_greater_than_nine || right_plus_one) return false;
      sol[L] = sol[R] = (10 + b) / 2;
      if (10 + b & 1) sol[R]++;
    } else
      return false;
  }
  for (int i = begin; i < n; i++) printf("%d", sol[i]);
  printf("\n");
  return true;
}
int main() {
  load();
  if (!solve()) printf("0\n");
  return 0;
}
