#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(2 <= n && n <= 100000);
  assert(n % 2 == 0);
  forn (i, n)
    a[i + 1] = s[i] - '0';
  for (int i = n; i >= 1; i--)
    for (int c = a[i] + 1; c <= 9; c++)
    {
      int s1 = 0, s2 = 0;
      int x1 = 0, x2 = 0;
      for (int j = 1; j < i; j++)
        if (j & 1)
          s1 += a[j];
        else
          s2 += a[j];
      if (i & 1)
        s1 += c;
      else
        s2 += c;
      for (int j = i + 1; j <= n; j++)
        if (j & 1)
          x1++;
        else
          x2++;
      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;
      }
    }
  printf("11");
  forn (i, n - 1)
    putc('0', stdout);
  puts("");
  return 0;
}
