static long CountEvenSumSequences ( long n ) {
  long count = 0 ;
  for ( int i = 0 ;
  i <= n ;
  i ++ ) {
    int even = i , odd = ( int ) n - i ;
    if ( odd % 2 == 1 ) continue ;
    long tot = ( power ( countOdd ( n ) , odd , M ) * nCrModPFermat ( n , odd , M ) ) % M ;
    tot = ( tot * power ( counteEven ( n ) , i , M ) ) % M ;
    count += tot ;
    count %= M ;
  }
  return count ;
}

static long CountEvenSumSequences ( long n ) { long count = 0 ; for ( int i = 0 ; i <= n ; i ++ ) { int even = i , odd = ( int ) n - i ; if ( odd % 2 == 1 ) continue ; long tot = ( power ( countOdd ( n ) , odd , M ) * nCrModPFermat ( n , odd , M ) ) % M ; tot = ( tot * power ( counteEven ( n ) , i , M ) ) % M ; count += tot ; count %= M ; } return count ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (continue_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier))) (identifier) (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier))))) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier))) (identifier) (identifier))))) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (return_statement (identifier))))