private static long get ( int n , long x , long [ ] l , long [ ] p ) {
  if ( n == 0 ) {
    return 1 ;
  }
  if ( x == 1 ) {
    return 0 ;
  }
  x -- ;
  if ( x <= l [ n - 1 ] ) {
    return get ( n - 1 , x , l , p ) ;
  }
  x -= l [ n - 1 ] ;
  if ( x == 1 ) {
    return p [ n - 1 ] + 1 ;
  }
  x -- ;
  if ( x == l [ n - 1 ] + 1 ) {
    x -- ;
  }
  return p [ n - 1 ] + 1 + get ( n - 1 , x , l , p ) ;
}

private static long get ( int n , long x , long [ ] l , long [ ] p ) { if ( n == 0 ) { return 1 ; } if ( x == 1 ) { return 0 ; } x -- ; if ( x <= l [ n - 1 ] ) { return get ( n - 1 , x , l , p ) ; } x -= l [ n - 1 ] ; if ( x == 1 ) { return p [ n - 1 ] + 1 ; } x -- ; if ( x == l [ n - 1 ] + 1 ) { x -- ; } return p [ n - 1 ] + 1 + get ( n - 1 , x , l , p ) ; }
(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: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) consequence: (block (expression_statement (update_expression (identifier))))) (return_statement (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))))))