public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int md [ ] = new int [ ] {
    - 1 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 };
    String S = sc . next ( ) ;
    String sp [ ] = S . split ( "/" ) ;
    int Y = Integer . parseInt ( sp [ 0 ] ) ;
    int M = Integer . parseInt ( sp [ 1 ] ) ;
    int D = Integer . parseInt ( sp [ 2 ] ) ;
    int ansy = 0 ;
    int ansm = 0 ;
    int ansd = 0 ;
    int y = Y ;
    int m = M ;
    while ( ansy == 0 ) {
      int day = md [ m ] ;
      if ( m == 2 ) {
        boolean flag = false ;
        if ( y % 4 == 0 ) {
          flag = true ;
        }
        if ( y % 100 == 0 ) {
          flag = false ;
        }
        if ( y % 400 == 0 ) {
          flag = true ;
        }
        if ( flag ) {
          day ++ ;
        }
      }
      for ( int d = D ;
      d <= day ;
      d ++ ) {
        if ( y % m == 0 ) {
          int y1 = y / m ;
          if ( y1 % d == 0 ) {
            ansy = y ;
            ansm = m ;
            ansd = d ;
            break ;
          }
        }
      }
      D = 1 ;
      m ++ ;
      if ( m == 13 ) {
        m = 1 ;
      }
      if ( m == 1 ) y ++ ;
    }
    String sy = String . valueOf ( ansy ) ;
    String sm = String . valueOf ( ansm ) ;
    String sd = String . valueOf ( ansd ) ;
    if ( ansm < 10 ) {
      sm = "0" + sm ;
    }
    if ( ansd < 10 ) {
      sd = "0" + sd ;
    }
    System . out . println ( sy + "/" + sm + "/" + sd ) ;
  }
  
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int md [ ] = new int [ ] { - 1 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; String S = sc . next ( ) ; String sp [ ] = S . split ( " / " ) ; int Y = Integer . parseInt ( sp [ 0 ] ) ; int M = Integer . parseInt ( sp [ 1 ] ) ; int D = Integer . parseInt ( sp [ 2 ] ) ; int ansy = 0 ; int ansm = 0 ; int ansd = 0 ; int y = Y ; int m = M ; while ( ansy == 0 ) { int day = md [ m ] ; if ( m == 2 ) { boolean flag = false ; if ( y % 4 == 0 ) { flag = true ; } if ( y % 100 == 0 ) { flag = false ; } if ( y % 400 == 0 ) { flag = true ; } if ( flag ) { day ++ ; } } for ( int d = D ; d <= day ; d ++ ) { if ( y % m == 0 ) { int y1 = y / m ; if ( y1 % d == 0 ) { ansy = y ; ansm = m ; ansd = d ; break ; } } } D = 1 ; m ++ ; if ( m == 13 ) { m = 1 ; } if ( m == 1 ) y ++ ; } String sy = String . valueOf ( ansy ) ; String sm = String . valueOf ( ansm ) ; String sd = String . valueOf ( ansd ) ; if ( ansm < 10 ) { sm = "0" + sm ; } if ( ansd < 10 ) { sd = "0" + sd ; } System . out . println ( sy + " / " + sm + " / " + sd ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions) value: (array_initializer (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal))))) (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: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (update_expression (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier)))))))