static long dfs ( long n ) {
  if ( n == 1 ) return 1 ;
  if ( n == 0 ) return 0 ;
  if ( map . containsKey ( n ) ) return map . get ( n ) ;
  long ret ;
  if ( n % 2 == 1 ) {
    ret = ( 2 * dfs ( n / 2 ) + dfs ( n / 2 + 1 ) ) % MOD ;
    map . put ( n , ret ) ;
  }
  else {
    ret = ( 2 * dfs ( n / 2 ) + dfs ( n / 2 - 1 ) ) % MOD ;
    map . put ( n , ret ) ;
  }
  return ret ;
}

static long dfs ( long n ) { if ( n == 1 ) return 1 ; if ( n == 0 ) return 0 ; if ( map . containsKey ( n ) ) return map . get ( n ) ; long ret ; if ( n % 2 == 1 ) { ret = ( 2 * dfs ( n / 2 ) + dfs ( n / 2 + 1 ) ) % MOD ; map . put ( n , ret ) ; } else { ret = ( 2 * dfs ( n / 2 ) + dfs ( n / 2 - 1 ) ) % MOD ; map . put ( n , ret ) ; } return ret ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (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: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))))) right: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))))) right: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) (return_statement (identifier))))