#include <bits/stdc++.h>
using namespace std;
deque<int> ans;
char input[100010];
int su[100010], n;
bool possible() {
  for (int i = 1; i <= n / 2; i++) {
    if (su[i] - su[n - i + 1] == 1) {
      su[i]--;
      su[i + 1] += 10;
    } else if (su[i] - su[n - i + 1] >= 10) {
      su[n - i]--;
      su[n - i + 1] += 10;
    }
    if (su[i] - su[n - i + 1] == 1) {
      su[i]--;
      su[i + 1] += 10;
    }
    if (su[i] != su[n - i + 1]) return false;
  }
  for (int i = 1; i <= n / 2; i++) {
    if (i == 1 && su[i] == 0) return false;
    if (su[i] > 18 || su[i] < 0) return false;
  }
  if (n % 2) {
    if (su[n / 2 + 1] % 2) return false;
    ans.push_back(su[n / 2 + 1] / 2);
  }
  return true;
}
void print() {
  for (int i = n / 2; i >= 1; i--) {
    int k = su[i] / 2;
    ans.push_front(su[i] - k);
    ans.push_back(k);
  }
  for (int i = 0; i < ans.size(); i++) printf("%d", ans[i]);
  exit(0);
}
int main() {
  scanf("%s", input + 1);
  n = (int)strlen(input + 1);
  for (int i = 1; i <= n; i++) su[i] = input[i] - '0';
  if (possible()) print();
  if (n >= 2 && input[1] == '1') {
    n--;
    su[1] = 10 + input[2] - '0';
    for (int i = 2; i <= n; i++) su[i] = input[i + 1] - '0';
    if (possible()) print();
  }
  puts("0");
  return 0;
}
