#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
char s[maxn];
char ans[maxn];
int sum[maxn];
int n;
int check() {
  for (int i = 0; i < n / 2;) {
    int l = i, r = n - 1 - i;
    if (sum[l] == sum[r])
      i++;
    else if (sum[l] == sum[r] + 1 || sum[l] == sum[r] + 11) {
      sum[l]--;
      sum[l + 1] += 10;
    } else if (sum[l] == sum[r] + 10) {
      sum[r - 1]--;
      sum[r] += 10;
    } else
      return 0;
  }
  if (n % 2 == 1) {
    if (sum[n / 2] % 2 == 1 || sum[n / 2] > 18 || sum[n / 2] < 0) return 0;
    ans[n / 2] = sum[n / 2] / 2 + '0';
  }
  for (int i = 0; i < n / 2; i++) {
    if (sum[i] > 18 || sum[i] < 0) return 0;
    ans[i] = (sum[i] + 1) / 2 + '0';
    ans[n - i - 1] = (sum[i]) / 2 + '0';
  }
  return ans[0] > '0';
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) sum[i] = s[i] - '0';
  if (check()) return puts(ans);
  if (s[0] == '1' && n > 1) {
    for (int i = 0; i < n; i++) sum[i] = s[i + 1] - '0';
    sum[0] += 10;
    n--;
    if (check())
      puts(ans);
    else
      printf("0");
  } else
    printf("0");
}
