static long solve ( long n ) {
  long a , b ;
  if ( n == 0 ) return 1 ;
  if ( n == 1 ) return 2 ;
  if ( check . containsKey ( n / 2 ) ) {
    a = check . get ( n / 2 ) ;
  }
  else {
    a = solve ( n / 2 ) % 1000000007 ;
    check . put ( n / 2 , a ) ;
  }
  if ( check . containsKey ( n / 2 - 1 ) ) {
    b = check . get ( n / 2 - 1 ) ;
  }
  else {
    b = solve ( n / 2 - 1 ) % 1000000007 ;
    check . put ( n / 2 - 1 , b ) ;
  }
  if ( n % 2 == 1 ) {
    return ( 2 * a + b ) % 1000000007 ;
  }
  else {
    return ( 2 * b + a ) % 1000000007 ;
  }
}

static long solve ( long n ) { long a , b ; if ( n == 0 ) return 1 ; if ( n == 1 ) return 2 ; if ( check . containsKey ( n / 2 ) ) { a = check . get ( n / 2 ) ; } else { a = solve ( n / 2 ) % 1000000007 ; check . put ( n / 2 , a ) ; } if ( check . containsKey ( n / 2 - 1 ) ) { b = check . get ( n / 2 - 1 ) ; } else { b = solve ( n / 2 - 1 ) % 1000000007 ; check . put ( n / 2 - 1 , b ) ; } if ( n % 2 == 1 ) { return ( 2 * a + b ) % 1000000007 ; } else { return ( 2 * b + a ) % 1000000007 ; } }
(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)) declarator: (variable_declarator name: (identifier))) (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 (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier)))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (identifier))) right: (decimal_integer_literal)))) alternative: (block (return_statement (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (identifier))) right: (decimal_integer_literal)))))))