#include <bits/stdc++.h>
using namespace std;
int ans[100001];
pair<int, int> p[100001][2][2];
int dp[100001][2][2];
int was[100001][2][2];
void go(string const& s, int i, int pl, int pr) {
  if (i == s.size() / 2 && s.size() % 2 == 0) {
    if (pl == pr) dp[i][pl][pr] = 1;
    return;
  }
  if (i == s.size() / 2 && s.size() % 2 != 0) {
    if ((s[i] + pl * 10 - pr) % 2 == 0 && s[i] + pl * 10 - pr < 19 &&
        s[i] + pl * 10 - pr >= 0)
      dp[i][pl][pr] = 1;
    return;
  }
  if (was[i][pl][pr]) return;
  was[i][pl][pr] = 1;
  for (int pl1 = 0; pl1 <= 1; ++pl1) {
    for (int pr1 = 0; pr1 <= 1; ++pr1) {
      go(s, i + 1, pl1, pr1);
      if ((i != 0 || pl * 10 + s[i] - pl1 != 0) &&
          pl * 10 + s[i] - pl1 == pr1 * 10 + s[s.size() - i - 1] - pr &&
          dp[i + 1][pl1][pr1] && pr1 * 10 + s[s.size() - i - 1] - pr < 19 &&
          pr1 * 10 + s[s.size() - i - 1] - pr >= 0) {
        dp[i][pl][pr] = 1;
        p[i][pl][pr] = make_pair(pl1, pr1);
      }
    }
  }
}
void get_ans(string const& s, int i, int pl, int pr, vector<int>& ans) {
  if (i == s.size() / 2 && s.size() % 2 != 0) {
    int t = s[i] + pl * 10 - pr;
    ans.push_back(t / 2);
    return;
  }
  if (i == s.size() / 2) return;
  int pl1 = p[i][pl][pr].first;
  int pr1 = p[i][pl][pr].second;
  int t = pl * 10 + s[i] - pl1;
  ans.push_back(t - t / 2);
  get_ans(s, i + 1, pl1, pr1, ans);
  ans.push_back(t / 2);
}
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) s[i] -= '0';
  go(s, 0, 0, 0);
  if (dp[0][0][0]) {
    vector<int> ans;
    get_ans(s, 0, 0, 0, ans);
    for (int i : ans) cout << i;
    cout << endl;
    return 0;
  }
  for (int i = 0; i < 100000; ++i) {
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < 2; ++k) dp[i][j][k] = was[i][j][k] = 0;
  }
  if (s[0] == 1 && s.size() > 1) {
    s.erase(s.begin());
    go(s, 0, 1, 0);
    if (dp[0][1][0]) {
      vector<int> ans;
      get_ans(s, 0, 1, 0, ans);
      for (int i : ans) cout << i;
      cout << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}
