#include <cstdio>
#include <cstring>
#include <cassert>

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

#define m 100010

int a[m], n;
char s[m];

int main()
{
  freopen("lucky.in", "r", stdin);
  freopen("lucky.out", "w", stdout);
  scanf("%s", s);
  n = strlen(s);
  assert(1 <= n && n <= 100);
  assert(s[0] != '0');
  forn (i, n)
  {
    assert('0' <= s[i] && s[i] <= '9');
    a[i + 1] = s[i] - '0';
  }
  int s1 = 0, s2 = 0;
  int x1 = 0, x2 = 0;
  for (int i = 1; i <= n; i++)
    if (i & 1) s1 += a[i];
    else       s2 += a[i];
  for (int i = n; i >= 1; i--)
  {
    if (i & 1) s1 -= a[i];
    else       s2 -= a[i];
    for (int c = a[i] + 1; c <= 9; c++)
    {
      if (i & 1) s1 += c;
      else       s2 += c;
      bool ok = false;
      if (s1 <= s2 && s1 + 9 * x1 >= s2)
      {
        int t = s2 - s1;
        for (int j = n; j > i; j--)
          if (j & 1)
            if (t >= 9) a[j] = 9, t -= 9;
            else        a[j] = t, t = 0;
          else          a[j] = 0;
        ok = true;
      }
      if (s2 < s1 && s2 + 9 * x2 >= s1)
      {
        int t = s1 - s2;
        for (int j = n; j > i; j--)
          if (j & 1)    a[j] = 0;
          else
            if (t >= 9) a[j] = 9, t -= 9;
            else        a[j] = t, t = 0;
        ok = true;
      }
      if (ok)
      {
        a[i] = c;
        forn (i, n)
          putc(a[i + 1] + '0', stdout);
        puts("");
        return 0;
      }
      if (i & 1) s1 -= c;
      else       s2 -= c;
    }
    if (i & 1) x1++;
    else       x2++;
  }
  printf("11");
  forn (i, n - 1)
    putc('0', stdout);
  puts("");
  return 0;
}
