#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const int NINF = -INF - 1;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
using namespace std;
char a[N];
int ans1[N];
int ans2[N];
int sum1[N];
int sum2[N];
int check(int lenth) {
  int g1 = 0, g2 = 0;
  for (int i = 0; i < lenth; i++) sum2[i] = sum1[i];
  for (int i = 0; i <= lenth / 2; i++) {
    int l = i;
    int r = lenth - l - 1;
    if (sum2[l] == sum2[r])
      continue;
    else if (sum2[l] - 1 == sum2[r] && l + 1 != r) {
      sum2[l + 1] += 10;
      sum2[l] -= 1;
    } else if (sum2[l] == sum2[r] + 10 && l + 1 != r) {
      sum2[r] += 10;
      sum2[r - 1] -= 1;
    } else if (sum2[l] - 1 == sum2[r] + 10) {
      sum2[l] -= 1;
      sum2[r] += 10;
      if (l + 1 != r) {
        sum2[l + 1] += 10;
        sum2[r - 1] -= 1;
      }
    } else
      return 0;
  }
  if (lenth % 2 == 1) {
    if (sum2[lenth / 2] % 2 != 0) return 0;
  }
  for (int i = 0; i < lenth / 2; i++) {
    if (sum2[i] < 0 || sum2[i] > 18) return 0;
    ans1[g1++] = (sum2[i] + 1) / 2;
    ans2[g2++] = sum2[i] / 2;
  }
  for (int i = lenth / 2; i < lenth; i++) {
    if (sum2[i] < 0 || sum2[i] > 18) return 0;
    ans2[g2++] = (sum2[i] + 1) / 2;
    ans1[g1++] = sum2[i] / 2;
  }
  return 1;
}
int main() {
  int len;
  scanf("%s", a);
  len = strlen(a);
  for (int i = 0; i < len; i++) sum1[i] = a[i] - '0';
  if (check(len)) {
    if (ans1[0] != 0)
      for (int i = 0; i < len; i++) printf("%d", ans1[i]);
    else if (ans2[0] != 0)
      for (int i = 0; i < len; i++) printf("%d", ans2[i]);
    else
      printf("0");
    printf("\n");
  } else {
    sum1[1] = sum1[1] + 10;
    for (int i = 1; i < len; i++) sum1[i - 1] = sum1[i];
    if (check(len - 1)) {
      if (ans1[0] != 0)
        for (int i = 0; i < len - 1; i++) printf("%d", ans1[i]);
      else if (ans2[0] != 0)
        for (int i = 0; i < len - 1; i++) printf("%d", ans2[i]);
      else
        printf("0");
      printf("\n");
    } else
      printf("0\n");
  }
  return 0;
}
