#include <cstdio>
#include <cstring>

#define maxn 1000

char s[maxn];

int f1( int n )
{
  return (n + 1) / 2;
}

int f2( int n )
{
  return n / 2;
}

int up( int i, int n )
{                 	
  return (f1(n) - f1(i)) * 9;
}
int low( int i, int n )
{
  return (f2(n) - f2(i)) * (-9);
}

int main( void )
{
  freopen("lucky.in", "r", stdin);
  freopen("lucky.out", "w", stdout);

  gets(s);

  int n = strlen(s);

  int b = 0;

  bool ok = false;
  int r = -1, rd = -1, rb = -1;
  for (int i = 0; i < n; i++)
  {
    s[i] -= '0';
    int sg = ((i & 1) ? -1 : 1);
    for (int j = s[i] + 1; j <= 9; j++)
    {
      int t = b + sg * j;
      if (low(i + 1, n) + t <= 0 && 0 <= up(i + 1, n) + t)
      {
        ok = true;
        r = i, rd = j, rb = t;
        break;
      }
    }
    b += sg * s[i];
    s[i] += '0';
  }

  int st;
  if (ok)
    s[r] = rd + '0', st = r + 1, b = rb;
  else
  {
    n++;
    b = 0;
    st = 0;
  }

  for (int i = st; i < n; i++)
  {
    int sg = ((i & 1) ? -1 : 1);
    for (int j = !i; j <= 9; j++)
    {
      int t = b + sg * j;
      if (low(i + 1, n) + t <= 0 && 0 <= up(i + 1, n) + t)
      {
        s[i] = j;
        break;
      }
    }
    b += sg * s[i];
    s[i] += '0';
  }

  printf("%s\n", s);
    
  

  return 0; 
}