#include <bits/stdc++.h>
char s[100010];
int a[100010], ans[100010];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) a[i] = s[i] - '0';
  int l = 0, r = len - 1, fa = 1;
  if (a[l] != a[r]) {
    a[l]--;
    a[l + 1] = a[l + 1] + 10;
    if (a[l] == 0) l++;
  }
  while (l <= r) {
    if (a[l] != a[r]) {
      if (a[l] - a[r] >= 10) {
        a[r - 1]--;
        a[r] = a[r] + 10;
      }
      if (a[l] - a[r] == 1) {
        a[l]--;
        a[l + 1] = a[l + 1] + 10;
      }
    }
    if (a[r] != a[l]) {
      fa = 0;
      break;
    }
    if (l != r) {
      ans[l] = a[l] - a[r] / 2;
      ans[r] = a[r] / 2;
    } else {
      if (a[l] & 1) {
        fa = 0;
        break;
      }
      ans[l] = a[r] / 2;
    }
    if (ans[l] < 0 || ans[l] > 9 || ans[r] < 0 || ans[r] > 9) {
      fa = 0;
      break;
    }
    l++;
    r--;
  }
  if (l <= r) fa = 0;
  if (fa == 0) {
    printf("%d\n", 0);
    return 0;
  }
  int num = 0;
  if (ans[num] == 0) num++;
  for (int i = num; i < len; i++) printf("%d", ans[i]);
  return 0;
}
