#include <bits/stdc++.h>
int main(void) {
  char str[50];
  int namana, s;
  int a, b, i, l;
  scanf("%s", str);
  a = strlen(str);
  if (a == 1) {
    printf("%s\n", str);
    return (0);
  }
  b = a - 2;
  l = a - 1;
  namana = 0;
  while (b >= 0) {
    namana += 57 - str[b + 1];
    if (namana > 1) {
      str[b]--;
      l = b;
      namana = 0;
    }
    b--;
  }
  i = 0;
  if (str[0] == 48) i++;
  while (i <= l) printf("%c", str[i++]);
  while (i++ < a) printf("9");
  printf("\n");
  return (0);
}
