public static void main ( String [ ] args ) throws IOException {
  FastScanner sc = new FastScanner ( ) ;
  PrintWriter out = new PrintWriter ( System . out ) ;
  ArrayList < String > lis = new ArrayList < String > ( ) ;
  String str = sc . next ( ) ;
  long cost = Long . parseLong ( str ) ;
  char [ ] extra = str . toCharArray ( ) ;
  long p = sc . nextLong ( ) ;
  int n = str . length ( ) ;
  for ( int i = n - 1 ;
  i >= 1 ;
  i -- ) {
    if ( extra [ i ] != '9' ) {
      extra [ i ] = '9' ;
      int j = i - 1 ;
      while ( j >= 0 ) {
        if ( extra [ j ] == '0' ) {
          extra [ j ] = '9' ;
          j -- ;
          continue ;
        }
        else {
          String val = ( extra [ j ] - '0' - 1 ) + "" ;
          extra [ j ] = val . charAt ( 0 ) ;
          break ;
        }
      }
    }
    StringBuilder ans = new StringBuilder ( ) ;
    for ( char e : extra ) ans . append ( e ) ;
    lis . add ( ans . toString ( ) ) ;
  }
  if ( lis . size ( ) == 0 ) {
    System . out . println ( cost ) ;
    return ;
  };
}

public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; ArrayList < String > lis = new ArrayList < String > ( ) ; String str = sc . next ( ) ; long cost = Long . parseLong ( str ) ; char [ ] extra = str . toCharArray ( ) ; long p = sc . nextLong ( ) ; int n = str . length ( ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { if ( extra [ i ] != '9' ) { extra [ i ] = '9' ; int j = i - 1 ; while ( j >= 0 ) { if ( extra [ j ] == '0' ) { extra [ j ] = '9' ; j -- ; continue ; } else { String val = ( extra [ j ] - '0' - 1 ) + " " ; extra [ j ] = val . charAt ( 0 ) ; break ; } } } StringBuilder ans = new StringBuilder ( ) ; for ( char e : extra ) ans . append ( e ) ; lis . add ( ans . toString ( ) ) ; } if ( lis . size ( ) == 0 ) { System . out . println ( cost ) ; return ; } ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) (expression_statement (update_expression (identifier))) (continue_statement)) alternative: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)) right: (decimal_integer_literal))) right: (string_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (break_statement))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (return_statement)))))