static long calculate ( long x , long k , long mod ) {
  long arr [ ] = new long [ N ] ;
  long count = 0 ;
  while ( mod > 1 ) {
    arr [ ( int ) count ++ ] = mod ;
    mod = phi [ ( int ) mod ] ;
  }
  long result = 1 ;
  long loop = count + 1 ;
  arr [ ( int ) count ] = 1 ;
  for ( int i = ( int ) Math . min ( k , loop ) - 1 ;
  i >= 0 ;
  i -- ) result = power ( x , result , arr [ i ] ) ;
  return result ;
}

static long calculate ( long x , long k , long mod ) { long arr [ ] = new long [ N ] ; long count = 0 ; while ( mod > 1 ) { arr [ ( int ) count ++ ] = mod ; mod = phi [ ( int ) mod ] ; } long result = 1 ; long loop = count + 1 ; arr [ ( int ) count ] = 1 ; for ( int i = ( int ) Math . min ( k , loop ) - 1 ; i >= 0 ; i -- ) result = power ( x , result , arr [ i ] ) ; return result ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (cast_expression type: (integral_type) value: (update_expression (identifier)))) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (cast_expression type: (integral_type) value: (identifier))))))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (cast_expression type: (integral_type) value: (identifier))) right: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (array_access array: (identifier) index: (identifier))))))) (return_statement (identifier))))