#include <bits/stdc++.h>
using namespace std;
char num[1000050];
int n[1000050];
char left[1000050];
int len;
bool Cout[1000050];
int ans[1000050];
bool check(int start) {
  for (int i = start, j = len - 1; j >= i; j--, i++) {
    int t1 = n[i] + 10 * Cout[i], t2 = n[j] + 10 * Cout[j];
    if (t1 == t2 && t1 < 19) {
      if (i == j) {
        if (t1 & 1)
          return 0;
        else
          ans[i] = ans[j] = t1 / 2;
      } else {
        ans[i] = (t1 + 1) / 2, ans[j] = t1 - ans[i];
        if (ans[i] < 0 || ans[j] < 0) return 0;
      }
    } else {
      if (abs(t1 - t2) == 1) {
        if (t1 > t2) {
          if (Cout[i + 1]) return 0;
          n[i]--, Cout[i + 1] = true, j++, i--;
        } else {
          if (Cout[j + 1]) return 0;
          n[j]--, Cout[j + 1] = true, j += 2, i -= 2;
        }
      } else if (abs(t1 - t2) == 9 || abs(t1 - t2) == 11 ||
                 abs(t1 - t2) == 10) {
        if (t1 > t2) {
          if (Cout[j]) return 0;
          n[j - 1]--, Cout[j] = true, j++, i--;
        } else {
          if (Cout[i] || abs(t1 - t2) == 10) return 0;
          n[i - 1]--, Cout[i] = true, j += 2, i -= 2;
        }
      } else
        return 0;
    }
  }
  if (ans[start] == 0) return 0;
  for (int i = start; i < len; i++) printf("%d", ans[i]);
  puts("");
  return 1;
}
int main() {
  scanf("%s", num);
  len = strlen(num);
  for (int i = 0; i < len; i++) n[i] = num[i] - '0';
  if (len == 1 && (num[0] - '0') & 1)
    return puts("0"), 0;
  else if (len == 1)
    return printf("%c\n", (num[0] - '0') / 2 + '0'), 0;
  memset(Cout, false, sizeof(Cout));
  if (check(0)) return 0;
  if (num[0] == '1') {
    for (int i = 0; i < len; i++) n[i] = num[i] - '0';
    memset(Cout, false, sizeof(Cout));
    Cout[1] = true;
    if (check(1)) return 0;
  }
  puts("0");
  return 0;
}
