private static long dfs ( int r , char l1 , char l2 , char l3 ) {
  return memo [ r ] [ l1 ] [ l2 ] [ l3 ] != 0 ? memo [ r ] [ l1 ] [ l2 ] [ l3 ] : ( memo [ r ] [ l1 ] [ l2 ] [ l3 ] = ( ( r == 1 ? 2 : dfs ( r - 1 , l2 , l3 , 'A' ) + dfs ( r - 1 , l2 , l3 , 'T' ) ) + ( l2 != 'G' && l3 != 'G' || l1 != 'A' && l2 != 'A' && l3 != 'A' ? r == 1 ? 1 : dfs ( r - 1 , l2 , l3 , 'C' ) : 0 ) + ( l2 != 'A' || l3 != 'C' ? r == 1 ? 1 : dfs ( r - 1 , l2 , l3 , 'G' ) : 0 ) ) % 1000000007 ) ;
}

private static long dfs ( int r , char l1 , char l2 , char l3 ) { return memo [ r ] [ l1 ] [ l2 ] [ l3 ] != 0 ? memo [ r ] [ l1 ] [ l2 ] [ l3 ] : ( memo [ r ] [ l1 ] [ l2 ] [ l3 ] = ( ( r == 1 ? 2 : dfs ( r - 1 , l2 , l3 , ' A ' ) + dfs ( r - 1 , l2 , l3 , ' T ' ) ) + ( l2 != ' G ' && l3 != ' G ' || l1 != ' A ' && l2 != ' A ' && l3 != ' A ' ? r == 1 ? 1 : dfs ( r - 1 , l2 , l3 , ' C ' ) : 0 ) + ( l2 != ' A ' || l3 != ' C ' ? r == 1 ? 1 : dfs ( r - 1 , l2 , l3 , ' G ' ) : 0 ) ) % 1000000007 ) ; }
(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)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (ternary_expression condition: (binary_expression left: (array_access array: (array_access array: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) index: (identifier)) index: (identifier)) right: (decimal_integer_literal)) consequence: (array_access array: (array_access array: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) index: (identifier)) index: (identifier)) alternative: (parenthesized_expression (assignment_expression left: (array_access array: (array_access array: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) index: (identifier)) index: (identifier)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (character_literal))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (character_literal)))))) right: (parenthesized_expression (ternary_expression condition: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (character_literal)))) consequence: (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (character_literal)))) alternative: (decimal_integer_literal)))) right: (parenthesized_expression (ternary_expression condition: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) consequence: (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (character_literal)))) alternative: (decimal_integer_literal))))) right: (decimal_integer_literal))))))))