#include <bits/stdc++.h>
using namespace std;
char str[100000 + 10];
char str1[100000 + 10];
char str2[100000 + 10];
char str3[100000 + 10];
int main() {
  cin >> str;
  int len = strlen(str);
  if (str[0] == '1' && str[0] != str[len - 1]) {
    for (int m = 0; m < len - 1; m++) {
      str[m] = str[m + 1];
    }
    str[len - 1] = '\0';
    len--;
    str[0] += 10;
  }
  for (int m = 0; m < len; m++) {
    str2[m] = str[m];
  }
  int t = 0;
  int num = 0;
  for (int m = 0; m < len / 2; m++) {
    if (str[m] > '9' && str[m] != str[len - m - 1] + 1) {
      str[len - m - 1] += 10;
      str[len - m - 2] -= 1;
    }
    if (str[len - 1 - m] < '0') {
      str[len - m - 1] += 10;
      str[len - m - 1 - 1] -= 1;
    }
    if (str[m] == str[len - 1 - m]) {
      if (str[m] == '9' + 10) {
        cout << "0" << endl;
        return 0;
      }
      for (int j = 0; j <= 9; j++) {
        if (str[m] - '0' - j >= 0 && str[m] - '0' - j <= 9) {
          str1[m] = str[m] - j;
          str1[len - 1 - m] = j + '0';
          break;
        }
      }
    } else {
      str[m] -= 1;
      str[m + 1] += 10;
      if (str[m] == str[len - 1 - m]) {
        for (int j = 0; j <= 9; j++) {
          if (str[m] - '0' - j >= 0 && str[m] - '0' - j <= 9) {
            str1[m] = str[m] - j;
            str1[len - 1 - m] = j + '0';
            break;
          }
        }
      } else {
        cout << "0" << endl;
        return 0;
      }
    }
  }
  int type = 0;
  if (len % 2 == 1) {
    if ((str[len / 2] - '0') % 2 == 0) {
      str1[len / 2] = (str[len / 2] - '0') / 2 + '0';
    } else {
      cout << "0" << endl;
      return 0;
    }
  }
  int j = 0, po = 0;
  for (int m = 0; m < len; m++) {
    cout << str1[m];
  }
}
