//
// Written by Fyodor Menshikov 24.02.2009
// 0:32-1:09
//

import java.io.*;
import java.util.*;

class ImpossibleException extends Exception {}

public class Main {

   Scanner in;
   PrintWriter out;

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   int[] toInt(char a[]) {
      asserT(a.length > 0);
      asserT(a[0] > '0');
      int b[] = new int[a.length];
      for (int i = 0; i < a.length; i++) {
         asserT('0' <= a[i] && a[i] <= '9');
         b[i] = a[i] - '0';
         asserT(0 <= b[i] && b[i] <= 9);
      }
      return b;
   }

   String toString(int a[]) {
      asserT(a.length > 0);
      asserT(a[0] > 0);
      StringBuilder b = new StringBuilder();
      for (int i = 0; i < a.length; i++) {
         asserT(0 <= a[i] && a[i] <= 9);
         b.append(a[i]);
      }
      return b.toString();
   }

   int[] removeFirst(int a[]) {
      asserT(a.length > 1);
      asserT(a[0] == 1);
      int b[] = new int[a.length - 1];
      for (int i = 0; i < b.length; i++) {
         b[i] = a[i + 1];
      }
      b[0] += 10;
      return b;
   }

   int[] makeSums(int a[]) throws ImpossibleException {
      int i1 = 0;
      int i2 = a.length - 1;
      asserT(i1 <= i2);
      while (i1 <= i2) {
         asserT(0 <= a[i1] && a[i1] <= 19);
         asserT(i1 < i2 && 0 <= a[i2] && a[i2] <= 9 || i1 == i2);
         if (a[i1] % 10 != a[i2] % 10) {
            asserT(i1 < i2);
            asserT(0 <= a[i1 + 1] && a[i1 + 1] <= 9);
            a[i1]--;
            a[i1 + 1] += 10;
         }
         if (a[i1] % 10 != a[i2] % 10) {
            throw new ImpossibleException();
         }
         if (a[i1] == 19) {
            throw new ImpossibleException();
         }
         asserT(0 <= a[i1] && a[i1] <= 18);
         asserT(a[i1] % 10 == a[i2] % 10);
         if (a[i1] == a[i2] + 10) {
            a[i2] += 10;
            int i = i2 - 1;
            while (true) {
               if (i == i1) {
                  throw new ImpossibleException();
               }
               asserT(i1 < i);
               if (a[i] > 0) {
                  a[i]--;
                  break;
               }
               asserT(a[i] == 0);
               a[i] = 9;
               i--;
            }
         }
         if (a[i1] != a[i2]) {
            throw new ImpossibleException();
         }
         if (i1 == 0 && a[i1] == 0) {
            throw new ImpossibleException();
         }
         if (i1 == i2 && a[i1] % 2 != 0) {
            throw new ImpossibleException();
         }
         i1++;
         i2--;
      }
      return a;
   }

   int[] makeMax(int a[]) {
      int i1 = 0;
      int i2 = a.length - 1;
      while (i1 < i2) {
         asserT(0 <= a[i1] && a[i1] <= 18);
         asserT(a[i1] == a[i2]);
         a[i1] = Math.min(a[i1], 9);
         a[i2] -= a[i1];
         i1++;
         i2--;
      }
      if (i1 == i2) {
         asserT(0 <= a[i1] && a[i1] <= 18 && a[i1] % 2 == 0);
         a[i1] /= 2;
      }
      return a;
   }

   String solve(String s) {
      int a[] = toInt(s.toCharArray());
      int a2[] = a.clone();
      try {
         return toString(makeMax(makeSums(a)));
      } catch (ImpossibleException e) {}
      a = a2;
      if (a.length > 1 && a[0] == 1) {
         try {
            return toString(makeMax(makeSums(removeFirst(a))));
         } catch (ImpossibleException e) {}
      }
      return "0";
   }

   void solve() {
      out.println(solve(in.nextLine()));
   }

   void run() {
      try {
          in = new Scanner(System.in);
          out = new PrintWriter(System.out);
      } catch (Exception e) {
         throw new Error(e);
      }
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String args[]) {
      new Main().run();
   }
}

class Check {

   Scanner in;
   PrintWriter out;

   int reverse(int n) {
      int ans = 0;
      while (n > 0) {
         ans *= 10;
         ans += n % 10;
         n /= 10;
      }
      return ans;
   }

   int f1(int n) {
      for (int i = n; i > 0; i--) {
         if (i + reverse(i) == n) {
            return i;
         }
      }
      return 0;
   }

   int f2(int n) {
      return Integer.parseInt(new Main().solve("" + n));
   }

   void solve() {
      for (int n = 1; n < 20000; n++) {
         out.println(n);
         if (f1(n) != f2(n)) {
            out.println("!=");
            return;
         }
      }
      out.println("==");
   }

   void run() {
      in = new Scanner(System.in);
      out = new PrintWriter(System.out, true);
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String args[]) {
      new Main().run();
   }
}