public static void main ( String [ ] args ) throws IOException {
  final String S ;
  try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) {
    S = reader . readLine ( ) ;
  }
  PrintWriter out = new PrintWriter ( System . out ) ;
  for ( int i = 0 ;
  i < scales . length ;
  i ++ ) {
    int idx = 0 ;
    int cnt = 0 ;
    for ( char c : keys ) {
      if ( c == S . charAt ( 0 ) ) cnt ++ ;
      if ( i < cnt ) break ;
      idx ++ ;
    }
    boolean flg = true ;
    for ( int j = 0 ;
    j < S . length ( ) ;
    j ++ ) {
      char c = S . charAt ( j ) ;
      if ( keys . length <= idx ) idx -= keys . length ;
      if ( c != keys [ idx ] ) {
        flg = false ;
        break ;
      }
      idx ++ ;
    }
    if ( flg ) {
      out . println ( scales [ i ] ) ;
      break ;
    }
  }
  out . flush ( ) ;
}

public static void main ( String [ ] args ) throws IOException { final String S ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { S = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; for ( int i = 0 ; i < scales . length ; i ++ ) { int idx = 0 ; int cnt = 0 ; for ( char c : keys ) { if ( c == S . charAt ( 0 ) ) cnt ++ ; if ( i < cnt ) break ; idx ++ ; } boolean flg = true ; for ( int j = 0 ; j < S . length ( ) ; j ++ ) { char c = S . charAt ( j ) ; if ( keys . length <= idx ) idx -= keys . length ; if ( c != keys [ idx ] ) { flg = false ; break ; } idx ++ ; } if ( flg ) { out . println ( scales [ i ] ) ; break ; } } out . flush ( ) ; }
(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 (modifiers) type: (type_identifier) declarator: (variable_declarator name: (identifier))) (try_with_resources_statement resources: (resource_specification (resource type: (type_identifier) name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (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)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (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))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) consequence: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (update_expression (identifier))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) (break_statement))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))