From 3401552c8ed30707d6f632592295db28fc0a0e98 Mon Sep 17 00:00:00 2001
From: Julian Kiryakov
Date: Wed, 18 Jun 2025 08:46:52 -0400
Subject: [PATCH 1/8] Add support for RLIKE (LIST)
---
.../predicate/regex/RLikePattern.java | 15 +-
.../predicate/regex/RLikePatternList.java | 95 ++++
.../esql/qa/single_node/PushQueriesIT.java | 36 ++
.../src/main/resources/where-like.csv-spec | 452 ++++++++++++++++++
.../esql/src/main/antlr/parser/Expression.g4 | 1 +
.../xpack/esql/action/EsqlCapabilities.java | 9 +-
.../esql/expression/ExpressionWritables.java | 2 +
.../function/scalar/string/regex/RLike.java | 4 +-
.../scalar/string/regex/RLikeList.java | 105 ++++
...StringCasingWithInsensitiveRegexMatch.java | 5 +-
.../xpack/esql/parser/EsqlBaseParser.interp | 6 +-
.../parser/EsqlBaseParserBaseListener.java | 12 +
.../parser/EsqlBaseParserBaseVisitor.java | 7 +
.../esql/parser/EsqlBaseParserListener.java | 12 +
.../esql/parser/EsqlBaseParserVisitor.java | 7 +
.../xpack/esql/parser/ExpressionBuilder.java | 19 +-
.../scalar/string/RLikeListErrorTests.java | 49 ++
.../string/RLikeListSerializationTests.java | 54 +++
.../scalar/string/RLikeListTests.java | 206 ++++++++
19 files changed, 1089 insertions(+), 7 deletions(-)
create mode 100644 x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePatternList.java
create mode 100644 x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLikeList.java
create mode 100644 x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListErrorTests.java
create mode 100644 x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListSerializationTests.java
create mode 100644 x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListTests.java
diff --git a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePattern.java b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePattern.java
index 0744977170911..72b8c2efb2eba 100644
--- a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePattern.java
+++ b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePattern.java
@@ -9,10 +9,14 @@
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.Operations;
import org.apache.lucene.util.automaton.RegExp;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Writeable;
+import java.io.IOException;
import java.util.Objects;
-public class RLikePattern extends AbstractStringPattern {
+public class RLikePattern extends AbstractStringPattern implements Writeable {
private final String regexpPattern;
@@ -20,6 +24,15 @@ public RLikePattern(String regexpPattern) {
this.regexpPattern = regexpPattern;
}
+ public RLikePattern(StreamInput in) throws IOException {
+ this(in.readString());
+ }
+
+ @Override
+ public void writeTo(StreamOutput out) throws IOException {
+ out.writeString(regexpPattern);
+ }
+
@Override
public Automaton createAutomaton(boolean ignoreCase) {
int matchFlags = ignoreCase ? RegExp.CASE_INSENSITIVE : 0;
diff --git a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePatternList.java b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePatternList.java
new file mode 100644
index 0000000000000..b63d92df59db0
--- /dev/null
+++ b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/RLikePatternList.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+package org.elasticsearch.xpack.esql.core.expression.predicate.regex;
+
+import org.apache.lucene.util.automaton.Automaton;
+import org.apache.lucene.util.automaton.Operations;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Writeable;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+public class RLikePatternList extends AbstractStringPattern implements Writeable {
+
+ private final List patternList;
+
+ public RLikePatternList(List patternList) {
+
+ this.patternList = patternList;
+ }
+
+ public RLikePatternList(StreamInput in) throws IOException {
+ this(in.readCollectionAsList(RLikePattern::new));
+ }
+
+ @Override
+ public void writeTo(StreamOutput out) throws IOException {
+ out.writeCollection(patternList, (o, pattern) -> pattern.writeTo(o));
+ }
+
+ public List patternList() {
+ return patternList;
+ }
+
+ /**
+ * Creates an automaton that matches any of the patterns in the list.
+ * We create a single automaton that is the union of all individual automatons to improve performance
+ */
+ @Override
+ public Automaton createAutomaton(boolean ignoreCase) {
+ List automatonList = patternList.stream().map(x -> x.createAutomaton(ignoreCase)).toList();
+ Automaton result = Operations.union(automatonList);
+ return Operations.determinize(result, Operations.DEFAULT_DETERMINIZE_WORK_LIMIT);
+ }
+
+ /**
+ * Returns a Java regex that matches any of the patterns in the list.
+ * The patterns are joined with the '|' operator to create a single regex.
+ */
+ @Override
+ public String asJavaRegex() {
+ return patternList.stream().map(RLikePattern::asJavaRegex).collect(Collectors.joining("|"));
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(patternList);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+
+ RLikePatternList other = (RLikePatternList) obj;
+ return patternList.equals(other.patternList);
+ }
+
+ /**
+ * Returns a string that matches any of the patterns in the list.
+ * The patterns are joined with the '|' operator to create a single regex string.
+ */
+ @Override
+ public String pattern() {
+ if (patternList.isEmpty()) {
+ return "";
+ }
+ if (patternList.size() == 1) {
+ return patternList.get(0).pattern();
+ }
+ return "(\"" + patternList.stream().map(RLikePattern::pattern).collect(Collectors.joining("\", \"")) + "\")";
+ }
+}
diff --git a/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushQueriesIT.java b/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushQueriesIT.java
index e14398d9c686a..0a9feab75efcf 100644
--- a/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushQueriesIT.java
+++ b/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushQueriesIT.java
@@ -275,6 +275,42 @@ public void testLikeList() throws IOException {
testPushQuery(value, esqlQuery, List.of(luceneQuery), dataNodeSignature, true);
}
+ public void testRLike() throws IOException {
+ String value = "v".repeat(between(1, 256));
+ String esqlQuery = """
+ FROM test
+ | WHERE test rlike "%value.*"
+ """;
+ String luceneQuery = switch (type) {
+ case KEYWORD -> "test:/%value.*/";
+ case CONSTANT_KEYWORD, MATCH_ONLY_TEXT_WITH_KEYWORD, AUTO, TEXT_WITH_KEYWORD -> "*:*";
+ case SEMANTIC_TEXT_WITH_KEYWORD -> "FieldExistsQuery [field=_primary_term]";
+ };
+ ComputeSignature dataNodeSignature = switch (type) {
+ case CONSTANT_KEYWORD, KEYWORD -> ComputeSignature.FILTER_IN_QUERY;
+ case AUTO, TEXT_WITH_KEYWORD, MATCH_ONLY_TEXT_WITH_KEYWORD, SEMANTIC_TEXT_WITH_KEYWORD -> ComputeSignature.FILTER_IN_COMPUTE;
+ };
+ testPushQuery(value, esqlQuery, List.of(luceneQuery), dataNodeSignature, true);
+ }
+
+ public void testRLikeList() throws IOException {
+ String value = "v".repeat(between(1, 256));
+ String esqlQuery = """
+ FROM test
+ | WHERE test rlike ("%value.*", "abc.*")
+ """;
+ String luceneQuery = switch (type) {
+ case CONSTANT_KEYWORD, MATCH_ONLY_TEXT_WITH_KEYWORD, AUTO, TEXT_WITH_KEYWORD -> "*:*";
+ case SEMANTIC_TEXT_WITH_KEYWORD -> "FieldExistsQuery [field=_primary_term]";
+ case KEYWORD -> "test:AutomatonQuery";
+ };
+ ComputeSignature dataNodeSignature = switch (type) {
+ case CONSTANT_KEYWORD, KEYWORD -> ComputeSignature.FILTER_IN_QUERY;
+ case AUTO, TEXT_WITH_KEYWORD, MATCH_ONLY_TEXT_WITH_KEYWORD, SEMANTIC_TEXT_WITH_KEYWORD -> ComputeSignature.FILTER_IN_COMPUTE;
+ };
+ testPushQuery(value, esqlQuery, List.of(luceneQuery), dataNodeSignature, true);
+ }
+
enum ComputeSignature {
FILTER_IN_COMPUTE(
matchesList().item("LuceneSourceOperator")
diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/where-like.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/where-like.csv-spec
index 6c5f13603e72b..2c2b555410527 100644
--- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/where-like.csv-spec
+++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/where-like.csv-spec
@@ -534,6 +534,458 @@ emp_no:integer | first_name:keyword
10055 | Georgy
;
+rlikeListEmptyArgWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike ("")
+| KEEP emp_no, first_name;
+
+emp_no:integer | first_name:keyword
+;
+
+rlikeListSingleArgWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name RLIKE ("Eberhardt.*")
+| KEEP emp_no, first_name;
+
+emp_no:integer | first_name:keyword
+10013 | Eberhardt
+;
+
+rlikeListTwoArgWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike ("Eberhardt.*", "testString.*")
+| KEEP emp_no, first_name;
+
+emp_no:integer | first_name:keyword
+10013 | Eberhardt
+;
+
+rlikeListDocExample
+required_capability: rlike_with_list_of_patterns
+// tag::rlikeListDocExample[]
+ROW message = "foobar"
+| WHERE message rlike ("foo.*", "bar.")
+// end::rlikeListDocExample[]
+;
+
+message:string
+foobar
+;
+
+rlikeListThreeArgWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike ("Eberhardt.*", "Ot.*", "Part.")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10003 | Parto
+10013 | Eberhardt
+10029 | Otmar
+;
+
+rlikeListMultipleWhere
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name RLIKE ("Eberhardt.*", "Ot.*", "Part.")
+| WHERE first_name RLIKE ("Eberhard.", "Otm.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10013 | Eberhardt
+10029 | Otmar
+;
+
+rlikeListAllWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike (".*")
+| KEEP emp_no, first_name
+| SORT emp_no
+| LIMIT 2;
+
+emp_no:integer | first_name:keyword
+10001 | Georgi
+10002 | Bezalel
+;
+
+rlikeListOverlappingPatterns
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike ("Eber.*", "Eberhardt")
+| KEEP emp_no, first_name;
+
+emp_no:integer | first_name:keyword
+10013 | Eberhardt
+;
+
+rlikeListCaseSensitive
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name RLIKE ("eberhardt", "EBERHARDT")
+| KEEP emp_no, first_name;
+
+emp_no:integer | first_name:keyword
+;
+
+rlikeListSpecialCharacters
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike (".*ar.*", ".*eor.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10001 | Georgi
+10003 | Parto
+10011 | Mary
+10013 | Eberhardt
+10029 | Otmar
+10055 | Georgy
+10058 | Berhard
+10068 | Charlene
+10069 | Margareta
+10074 | Mokhtar
+10082 | Parviz
+10089 | Sudharsan
+10095 | Hilari
+;
+
+rlikeListEscapedWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike ("Eberhar\\*")
+| KEEP emp_no, first_name;
+
+emp_no:integer | first_name:keyword
+;
+
+rlikeListNineOrMoreLetters
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike (".{9,}.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10004 | Chirstian
+10010 | Duangkaew
+10013 | Eberhardt
+10017 | Cristinel
+10025 | Prasadram
+10059 | Alejandro
+10069 | Margareta
+10089 | Sudharsan
+10092 | Valdiodio
+10098 | Sreekrishna
+;
+
+notRlikeListThreeArgWildcardNotOtherFilter
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name not rlike ("Eberhardt.*", "Ot.*", "Part.") and emp_no < 10010
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10001 | Georgi
+10002 | Bezalel
+10004 | Chirstian
+10005 | Kyoichi
+10006 | Anneke
+10007 | Tzvetan
+10008 | Saniya
+10009 | Sumant
+;
+
+rlikeListBeginningWithWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name rlike ("A.*", "B.*", "C.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10002 | Bezalel
+10004 | Chirstian
+10006 | Anneke
+10014 | Berni
+10017 | Cristinel
+10023 | Bojan
+10049 | Basil
+10056 | Brendon
+10058 | Berhard
+10059 | Alejandro
+10060 | Breannda
+10062 | Anoosh
+10067 | Claudi
+10068 | Charlene
+10091 | Amabile
+10094 | Arumugam
+;
+
+notRlikeListThreeArgWildcardOtherFirst
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE emp_no < 10010 and first_name not rlike ("Eberhardt.*", "Ot.*", "Part.")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10001 | Georgi
+10002 | Bezalel
+10004 | Chirstian
+10005 | Kyoichi
+10006 | Anneke
+10007 | Tzvetan
+10008 | Saniya
+10009 | Sumant
+;
+
+notRlikeFiveOrLessLetters
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name not rlike (".{6,}.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10003 | Parto
+10011 | Mary
+10014 | Berni
+10021 | Ramzi
+10023 | Bojan
+10029 | Otmar
+10040 | Weiyi
+10041 | Uri
+10042 | Magy
+10045 | Moss
+10049 | Basil
+10057 | Ebbe
+10061 | Tse
+10063 | Gino
+10064 | Udi
+10066 | Kwee
+10071 | Hisao
+10073 | Shir
+10075 | Gao
+10076 | Erez
+10077 | Mona
+10078 | Danel
+10083 | Vishv
+10084 | Tuval
+10097 | Remzi
+;
+
+notRlikeListMultipleWhere
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name NOT RLIKE ("Eberhardt.*", "Ot.*", "Part.", "A.*", "B.*", "C.*", "D.*")
+| WHERE first_name NOT RLIKE ("Eberhard.", "Otm.*", "F.*", "G.*", "H.*", "I.*", "J.*", "K.*", "L.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10007 | Tzvetan
+10008 | Saniya
+10009 | Sumant
+10011 | Mary
+10012 | Patricio
+10020 | Mayuko
+10021 | Ramzi
+10022 | Shahaf
+10024 | Suzette
+10025 | Prasadram
+10026 | Yongqiao
+10040 | Weiyi
+10041 | Uri
+10042 | Magy
+10043 | Yishay
+10044 | Mingsen
+10045 | Moss
+10047 | Zvonko
+10050 | Yinghua
+10053 | Sanjiv
+10054 | Mayumi
+10057 | Ebbe
+10061 | Tse
+10064 | Udi
+10065 | Satosi
+10069 | Margareta
+10070 | Reuven
+10073 | Shir
+10074 | Mokhtar
+10076 | Erez
+10077 | Mona
+10080 | Premal
+10081 | Zhongwei
+10082 | Parviz
+10083 | Vishv
+10084 | Tuval
+10086 | Somnath
+10087 | Xinglin
+10089 | Sudharsan
+10092 | Valdiodio
+10093 | Sailaja
+10097 | Remzi
+10098 | Sreekrishna
+10099 | Valter
+;
+
+notRlikeListNotField
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE NOT first_name RLIKE ("Eberhardt.*", "Ot.*", "Part.", "A.*", "B.*", "C.*", "D.*")
+| WHERE first_name NOT RLIKE ("Eberhard.", "Otm.*", "F.*", "G.*", "H.*", "I.*", "J.*", "K.*", "L.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10007 | Tzvetan
+10008 | Saniya
+10009 | Sumant
+10011 | Mary
+10012 | Patricio
+10020 | Mayuko
+10021 | Ramzi
+10022 | Shahaf
+10024 | Suzette
+10025 | Prasadram
+10026 | Yongqiao
+10040 | Weiyi
+10041 | Uri
+10042 | Magy
+10043 | Yishay
+10044 | Mingsen
+10045 | Moss
+10047 | Zvonko
+10050 | Yinghua
+10053 | Sanjiv
+10054 | Mayumi
+10057 | Ebbe
+10061 | Tse
+10064 | Udi
+10065 | Satosi
+10069 | Margareta
+10070 | Reuven
+10073 | Shir
+10074 | Mokhtar
+10076 | Erez
+10077 | Mona
+10080 | Premal
+10081 | Zhongwei
+10082 | Parviz
+10083 | Vishv
+10084 | Tuval
+10086 | Somnath
+10087 | Xinglin
+10089 | Sudharsan
+10092 | Valdiodio
+10093 | Sailaja
+10097 | Remzi
+10098 | Sreekrishna
+10099 | Valter
+;
+
+notRlikeListAllWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name NOT RLIKE (".*")
+| KEEP emp_no, first_name
+| SORT emp_no
+| LIMIT 2;
+
+emp_no:integer | first_name:keyword
+10030 | null
+10031 | null
+;
+
+notRlikeListWildcard
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE first_name NOT RLIKE ("A.*","B.*", "C.*", "D.*","E.*", "F.*", "G.*", "H.*", "I.*", "J.*", "K.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10003 | Parto
+10007 | Tzvetan
+10008 | Saniya
+10009 | Sumant
+10011 | Mary
+10012 | Patricio
+10019 | Lillian
+10020 | Mayuko
+10021 | Ramzi
+10022 | Shahaf
+10024 | Suzette
+10025 | Prasadram
+10026 | Yongqiao
+10029 | Otmar
+10040 | Weiyi
+10041 | Uri
+10042 | Magy
+10043 | Yishay
+10044 | Mingsen
+10045 | Moss
+10046 | Lucien
+10047 | Zvonko
+10050 | Yinghua
+10053 | Sanjiv
+10054 | Mayumi
+10061 | Tse
+10064 | Udi
+10065 | Satosi
+10069 | Margareta
+10070 | Reuven
+10073 | Shir
+10074 | Mokhtar
+10077 | Mona
+10080 | Premal
+10081 | Zhongwei
+10082 | Parviz
+10083 | Vishv
+10084 | Tuval
+10086 | Somnath
+10087 | Xinglin
+10089 | Sudharsan
+10092 | Valdiodio
+10093 | Sailaja
+10097 | Remzi
+10098 | Sreekrishna
+10099 | Valter
+;
+
+rlikeListWithUpperTurnedInsensitive
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE TO_UPPER(first_name) RLIKE ("GEOR.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10001 | Georgi
+10055 | Georgy
+;
+
+rlikeListWithUpperTurnedInsensitiveMult
+required_capability: rlike_with_list_of_patterns
+FROM employees
+| WHERE TO_UPPER(first_name) RLIKE ("GEOR.*", "WE.*")
+| KEEP emp_no, first_name
+| SORT emp_no;
+
+emp_no:integer | first_name:keyword
+10001 | Georgi
+10040 | Weiyi
+10055 | Georgy
+;
+
likeAll
from employees | where first_name like "*" and emp_no > 10028 | sort emp_no | keep emp_no, first_name | limit 2;
diff --git a/x-pack/plugin/esql/src/main/antlr/parser/Expression.g4 b/x-pack/plugin/esql/src/main/antlr/parser/Expression.g4
index abb8fe09164f5..0462b2d6a67ee 100644
--- a/x-pack/plugin/esql/src/main/antlr/parser/Expression.g4
+++ b/x-pack/plugin/esql/src/main/antlr/parser/Expression.g4
@@ -21,6 +21,7 @@ regexBooleanExpression
: valueExpression (NOT)? LIKE string #likeExpression
| valueExpression (NOT)? RLIKE string #rlikeExpression
| valueExpression (NOT)? LIKE LP string (COMMA string )* RP #likeListExpression
+ | valueExpression (NOT)? RLIKE LP string (COMMA string )* RP #rlikeListExpression
;
matchBooleanExpression
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
index 9a8b71e8e5eea..7d52468b3207e 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
@@ -1197,6 +1197,9 @@ public enum Cap {
*/
KNN_FUNCTION(Build.current().isSnapshot()),
+ /**
+ * Support for the LIKE operator with a list of wildcards.
+ */
LIKE_WITH_LIST_OF_PATTERNS,
/**
@@ -1215,7 +1218,11 @@ public enum Cap {
/**
* (Re)Added EXPLAIN command
*/
- EXPLAIN(Build.current().isSnapshot());
+ EXPLAIN(Build.current().isSnapshot()),
+ /**
+ * Support for the RLIKE operator with a list of regexes.
+ */
+ RLIKE_WITH_LIST_OF_PATTERNS;
private final boolean enabled;
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/ExpressionWritables.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/ExpressionWritables.java
index 901f364a60041..53787508779a2 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/ExpressionWritables.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/ExpressionWritables.java
@@ -82,6 +82,7 @@
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Space;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Trim;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
+import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLikeList;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLike;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLikeList;
import org.elasticsearch.xpack.esql.expression.function.scalar.util.Delay;
@@ -182,6 +183,7 @@ public static List unaryScalars() {
entries.add(Neg.ENTRY);
entries.add(Not.ENTRY);
entries.add(RLike.ENTRY);
+ entries.add(RLikeList.ENTRY);
entries.add(RTrim.ENTRY);
entries.add(Scalb.ENTRY);
entries.add(Signum.ENTRY);
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java
index dea36bba2c4fb..d1dcc29fc2d0f 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLike.java
@@ -33,13 +33,15 @@ public class RLike extends RegexMatch {
Use `RLIKE` to filter data based on string patterns using using
<>. `RLIKE` usually acts on a field placed on
the left-hand side of the operator, but it can also act on a constant (literal)
- expression. The right-hand side of the operator represents the pattern.""", detailedDescription = """
+ expression. The right-hand side of the operator represents the pattern or a list of patterns.""", detailedDescription = """
Matching special characters (eg. `.`, `*`, `(`...) will require escaping.
The escape character is backslash `\\`. Since also backslash is a special character in string literals,
it will require further escaping.
<>
+ <>
+
To reduce the overhead of escaping, we suggest using triple quotes strings `\"\"\"`
<>
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLikeList.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLikeList.java
new file mode 100644
index 0000000000000..38c7f65efed4d
--- /dev/null
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RLikeList.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.xpack.esql.expression.function.scalar.string.regex;
+
+import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.xpack.esql.core.expression.Expression;
+import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePatternList;
+import org.elasticsearch.xpack.esql.core.querydsl.query.AutomatonQuery;
+import org.elasticsearch.xpack.esql.core.querydsl.query.Query;
+import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
+import org.elasticsearch.xpack.esql.core.tree.Source;
+import org.elasticsearch.xpack.esql.expression.function.Param;
+import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
+import org.elasticsearch.xpack.esql.optimizer.rules.physical.local.LucenePushdownPredicates;
+import org.elasticsearch.xpack.esql.planner.TranslatorHandler;
+
+import java.io.IOException;
+
+public class RLikeList extends RegexMatch {
+ public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
+ Expression.class,
+ "RLikeList",
+ RLikeList::new
+ );
+
+ /**
+ * The documentation for this function is in RLike, and shown to the users `RLIKE` in the docs.
+ */
+ public RLikeList(
+ Source source,
+ @Param(name = "str", type = { "keyword", "text" }, description = "A literal value.") Expression value,
+ @Param(name = "patterns", type = { "keyword", "text" }, description = "A list of regular expressions.") RLikePatternList patterns
+ ) {
+ this(source, value, patterns, false);
+ }
+
+ public RLikeList(Source source, Expression field, RLikePatternList rLikePattern, boolean caseInsensitive) {
+ super(source, field, rLikePattern, caseInsensitive);
+ }
+
+ private RLikeList(StreamInput in) throws IOException {
+ this(
+ Source.readFrom((PlanStreamInput) in),
+ in.readNamedWriteable(Expression.class),
+ new RLikePatternList(in),
+ deserializeCaseInsensitivity(in)
+ );
+ }
+
+ @Override
+ public void writeTo(StreamOutput out) throws IOException {
+ source().writeTo(out);
+ out.writeNamedWriteable(field());
+ pattern().writeTo(out);
+ serializeCaseInsensitivity(out);
+ }
+
+ @Override
+ public String name() {
+ return ENTRY.name;
+ }
+
+ @Override
+ public String getWriteableName() {
+ return ENTRY.name;
+ }
+
+ @Override
+ protected RLikeList replaceChild(Expression newChild) {
+ return new RLikeList(source(), newChild, pattern(), caseInsensitive());
+ }
+
+ @Override
+ public Translatable translatable(LucenePushdownPredicates pushdownPredicates) {
+ return pushdownPredicates.isPushableAttribute(field()) ? Translatable.YES : Translatable.NO;
+ }
+
+ /**
+ * Returns a {@link Query} that matches the field against the provided patterns.
+ * For now, we only support a single pattern in the list for pushdown.
+ */
+ @Override
+ public Query asQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHandler handler) {
+ var field = field();
+ LucenePushdownPredicates.checkIsPushableAttribute(field);
+ return translateField(handler.nameOf(field instanceof FieldAttribute fa ? fa.exactAttribute() : field));
+ }
+
+ private Query translateField(String targetFieldName) {
+ return new AutomatonQuery(source(), targetFieldName, pattern().createAutomaton(caseInsensitive()));
+ }
+
+ @Override
+ protected NodeInfo extends Expression> info() {
+ return NodeInfo.create(this, RLikeList::new, field(), pattern(), caseInsensitive());
+ }
+}
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/ReplaceStringCasingWithInsensitiveRegexMatch.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/ReplaceStringCasingWithInsensitiveRegexMatch.java
index fa43d51634efd..33de97cc9d08e 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/ReplaceStringCasingWithInsensitiveRegexMatch.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/ReplaceStringCasingWithInsensitiveRegexMatch.java
@@ -9,6 +9,7 @@
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.expression.Literal;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePatternList;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RegexMatch;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.StringPattern;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardPatternList;
@@ -29,8 +30,8 @@ public ReplaceStringCasingWithInsensitiveRegexMatch() {
@Override
protected Expression rule(RegexMatch extends StringPattern> regexMatch, LogicalOptimizerContext unused) {
Expression e = regexMatch;
- if (regexMatch.pattern() instanceof WildcardPatternList) {
- // This optimization is not supported for WildcardPatternList for now
+ if (regexMatch.pattern() instanceof WildcardPatternList || regexMatch.pattern() instanceof RLikePatternList) {
+ // This optimization is not supported for WildcardPatternList and RLikePatternList for now
return e;
}
if (regexMatch.field() instanceof ChangeCase changeCase) {
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp
index 3b180084e28ad..f832502f7e9dd 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp
@@ -372,4 +372,8 @@ joinPredicate
atn:
-[4, 1, 139, 811, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 182, 8, 1, 10, 1, 12, 1, 185, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 194, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 223, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 236, 8, 7, 10, 7, 12, 7, 239, 9, 7, 1, 8, 1, 8, 1, 8, 3, 8, 244, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 5, 9, 251, 8, 9, 10, 9, 12, 9, 254, 9, 9, 1, 10, 1, 10, 1, 10, 3, 10, 259, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 5, 13, 270, 8, 13, 10, 13, 12, 13, 273, 9, 13, 1, 13, 3, 13, 276, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 287, 8, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 301, 8, 19, 10, 19, 12, 19, 304, 9, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 3, 21, 311, 8, 21, 1, 21, 1, 21, 3, 21, 315, 8, 21, 1, 22, 1, 22, 1, 22, 5, 22, 320, 8, 22, 10, 22, 12, 22, 323, 9, 22, 1, 23, 1, 23, 1, 23, 3, 23, 328, 8, 23, 1, 24, 1, 24, 1, 24, 5, 24, 333, 8, 24, 10, 24, 12, 24, 336, 9, 24, 1, 25, 1, 25, 1, 25, 5, 25, 341, 8, 25, 10, 25, 12, 25, 344, 9, 25, 1, 26, 1, 26, 1, 26, 5, 26, 349, 8, 26, 10, 26, 12, 26, 352, 9, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 3, 28, 359, 8, 28, 1, 29, 1, 29, 3, 29, 363, 8, 29, 1, 30, 1, 30, 3, 30, 367, 8, 30, 1, 31, 1, 31, 1, 31, 3, 31, 372, 8, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 5, 33, 381, 8, 33, 10, 33, 12, 33, 384, 9, 33, 1, 34, 1, 34, 3, 34, 388, 8, 34, 1, 34, 1, 34, 3, 34, 392, 8, 34, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 404, 8, 37, 10, 37, 12, 37, 407, 9, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 417, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 423, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 5, 42, 435, 8, 42, 10, 42, 12, 42, 438, 9, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 3, 47, 458, 8, 47, 1, 47, 1, 47, 1, 47, 1, 47, 5, 47, 464, 8, 47, 10, 47, 12, 47, 467, 9, 47, 3, 47, 469, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 474, 8, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 490, 8, 51, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 496, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 503, 8, 52, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 55, 4, 55, 512, 8, 55, 11, 55, 12, 55, 513, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 5, 57, 526, 8, 57, 10, 57, 12, 57, 529, 9, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 5, 60, 538, 8, 60, 10, 60, 12, 60, 541, 9, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 3, 62, 549, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 557, 8, 63, 1, 64, 1, 64, 1, 64, 1, 64, 3, 64, 563, 8, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 3, 65, 576, 8, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 583, 8, 65, 10, 65, 12, 65, 586, 9, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 3, 65, 593, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 598, 8, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 606, 8, 65, 10, 65, 12, 65, 609, 9, 65, 1, 66, 1, 66, 3, 66, 613, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 620, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 627, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 5, 66, 634, 8, 66, 10, 66, 12, 66, 637, 9, 66, 1, 66, 1, 66, 3, 66, 641, 8, 66, 1, 67, 1, 67, 1, 67, 3, 67, 646, 8, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 656, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 662, 8, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 5, 69, 670, 8, 69, 10, 69, 12, 69, 673, 9, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 3, 70, 683, 8, 70, 1, 70, 1, 70, 1, 70, 5, 70, 688, 8, 70, 10, 70, 12, 70, 691, 9, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 5, 71, 699, 8, 71, 10, 71, 12, 71, 702, 9, 71, 1, 71, 1, 71, 3, 71, 706, 8, 71, 3, 71, 708, 8, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 5, 73, 718, 8, 73, 10, 73, 12, 73, 721, 9, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 742, 8, 75, 10, 75, 12, 75, 745, 9, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 753, 8, 75, 10, 75, 12, 75, 756, 9, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 764, 8, 75, 10, 75, 12, 75, 767, 9, 75, 1, 75, 1, 75, 3, 75, 771, 8, 75, 1, 76, 1, 76, 1, 77, 1, 77, 3, 77, 777, 8, 77, 1, 78, 3, 78, 780, 8, 78, 1, 78, 1, 78, 1, 79, 3, 79, 785, 8, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 5, 84, 804, 8, 84, 10, 84, 12, 84, 807, 9, 84, 1, 85, 1, 85, 1, 85, 0, 5, 2, 114, 130, 138, 140, 86, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 0, 9, 2, 0, 53, 53, 107, 107, 1, 0, 101, 102, 2, 0, 57, 57, 63, 63, 2, 0, 66, 66, 69, 69, 1, 0, 87, 88, 1, 0, 89, 91, 2, 0, 65, 65, 78, 78, 2, 0, 80, 80, 82, 86, 2, 0, 22, 22, 24, 25, 838, 0, 172, 1, 0, 0, 0, 2, 175, 1, 0, 0, 0, 4, 193, 1, 0, 0, 0, 6, 222, 1, 0, 0, 0, 8, 224, 1, 0, 0, 0, 10, 227, 1, 0, 0, 0, 12, 229, 1, 0, 0, 0, 14, 232, 1, 0, 0, 0, 16, 243, 1, 0, 0, 0, 18, 247, 1, 0, 0, 0, 20, 255, 1, 0, 0, 0, 22, 260, 1, 0, 0, 0, 24, 263, 1, 0, 0, 0, 26, 266, 1, 0, 0, 0, 28, 286, 1, 0, 0, 0, 30, 288, 1, 0, 0, 0, 32, 290, 1, 0, 0, 0, 34, 292, 1, 0, 0, 0, 36, 294, 1, 0, 0, 0, 38, 296, 1, 0, 0, 0, 40, 305, 1, 0, 0, 0, 42, 308, 1, 0, 0, 0, 44, 316, 1, 0, 0, 0, 46, 324, 1, 0, 0, 0, 48, 329, 1, 0, 0, 0, 50, 337, 1, 0, 0, 0, 52, 345, 1, 0, 0, 0, 54, 353, 1, 0, 0, 0, 56, 358, 1, 0, 0, 0, 58, 362, 1, 0, 0, 0, 60, 366, 1, 0, 0, 0, 62, 371, 1, 0, 0, 0, 64, 373, 1, 0, 0, 0, 66, 376, 1, 0, 0, 0, 68, 385, 1, 0, 0, 0, 70, 393, 1, 0, 0, 0, 72, 396, 1, 0, 0, 0, 74, 399, 1, 0, 0, 0, 76, 416, 1, 0, 0, 0, 78, 418, 1, 0, 0, 0, 80, 424, 1, 0, 0, 0, 82, 428, 1, 0, 0, 0, 84, 431, 1, 0, 0, 0, 86, 439, 1, 0, 0, 0, 88, 443, 1, 0, 0, 0, 90, 446, 1, 0, 0, 0, 92, 450, 1, 0, 0, 0, 94, 453, 1, 0, 0, 0, 96, 473, 1, 0, 0, 0, 98, 477, 1, 0, 0, 0, 100, 480, 1, 0, 0, 0, 102, 485, 1, 0, 0, 0, 104, 491, 1, 0, 0, 0, 106, 504, 1, 0, 0, 0, 108, 507, 1, 0, 0, 0, 110, 511, 1, 0, 0, 0, 112, 515, 1, 0, 0, 0, 114, 519, 1, 0, 0, 0, 116, 530, 1, 0, 0, 0, 118, 532, 1, 0, 0, 0, 120, 534, 1, 0, 0, 0, 122, 542, 1, 0, 0, 0, 124, 548, 1, 0, 0, 0, 126, 550, 1, 0, 0, 0, 128, 558, 1, 0, 0, 0, 130, 597, 1, 0, 0, 0, 132, 640, 1, 0, 0, 0, 134, 642, 1, 0, 0, 0, 136, 655, 1, 0, 0, 0, 138, 661, 1, 0, 0, 0, 140, 682, 1, 0, 0, 0, 142, 692, 1, 0, 0, 0, 144, 711, 1, 0, 0, 0, 146, 713, 1, 0, 0, 0, 148, 724, 1, 0, 0, 0, 150, 770, 1, 0, 0, 0, 152, 772, 1, 0, 0, 0, 154, 776, 1, 0, 0, 0, 156, 779, 1, 0, 0, 0, 158, 784, 1, 0, 0, 0, 160, 788, 1, 0, 0, 0, 162, 790, 1, 0, 0, 0, 164, 792, 1, 0, 0, 0, 166, 797, 1, 0, 0, 0, 168, 799, 1, 0, 0, 0, 170, 808, 1, 0, 0, 0, 172, 173, 3, 2, 1, 0, 173, 174, 5, 0, 0, 1, 174, 1, 1, 0, 0, 0, 175, 176, 6, 1, -1, 0, 176, 177, 3, 4, 2, 0, 177, 183, 1, 0, 0, 0, 178, 179, 10, 1, 0, 0, 179, 180, 5, 52, 0, 0, 180, 182, 3, 6, 3, 0, 181, 178, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 3, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 194, 3, 22, 11, 0, 187, 194, 3, 12, 6, 0, 188, 194, 3, 92, 46, 0, 189, 190, 4, 2, 1, 0, 190, 194, 3, 24, 12, 0, 191, 192, 4, 2, 2, 0, 192, 194, 3, 88, 44, 0, 193, 186, 1, 0, 0, 0, 193, 187, 1, 0, 0, 0, 193, 188, 1, 0, 0, 0, 193, 189, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 194, 5, 1, 0, 0, 0, 195, 223, 3, 40, 20, 0, 196, 223, 3, 8, 4, 0, 197, 223, 3, 70, 35, 0, 198, 223, 3, 64, 32, 0, 199, 223, 3, 42, 21, 0, 200, 223, 3, 66, 33, 0, 201, 223, 3, 72, 36, 0, 202, 223, 3, 74, 37, 0, 203, 223, 3, 78, 39, 0, 204, 223, 3, 80, 40, 0, 205, 223, 3, 94, 47, 0, 206, 223, 3, 82, 41, 0, 207, 223, 3, 164, 82, 0, 208, 223, 3, 104, 52, 0, 209, 223, 3, 128, 64, 0, 210, 223, 3, 98, 49, 0, 211, 223, 3, 108, 54, 0, 212, 213, 4, 3, 3, 0, 213, 223, 3, 102, 51, 0, 214, 215, 4, 3, 4, 0, 215, 223, 3, 100, 50, 0, 216, 217, 4, 3, 5, 0, 217, 223, 3, 106, 53, 0, 218, 219, 4, 3, 6, 0, 219, 223, 3, 126, 63, 0, 220, 221, 4, 3, 7, 0, 221, 223, 3, 118, 59, 0, 222, 195, 1, 0, 0, 0, 222, 196, 1, 0, 0, 0, 222, 197, 1, 0, 0, 0, 222, 198, 1, 0, 0, 0, 222, 199, 1, 0, 0, 0, 222, 200, 1, 0, 0, 0, 222, 201, 1, 0, 0, 0, 222, 202, 1, 0, 0, 0, 222, 203, 1, 0, 0, 0, 222, 204, 1, 0, 0, 0, 222, 205, 1, 0, 0, 0, 222, 206, 1, 0, 0, 0, 222, 207, 1, 0, 0, 0, 222, 208, 1, 0, 0, 0, 222, 209, 1, 0, 0, 0, 222, 210, 1, 0, 0, 0, 222, 211, 1, 0, 0, 0, 222, 212, 1, 0, 0, 0, 222, 214, 1, 0, 0, 0, 222, 216, 1, 0, 0, 0, 222, 218, 1, 0, 0, 0, 222, 220, 1, 0, 0, 0, 223, 7, 1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 130, 65, 0, 226, 9, 1, 0, 0, 0, 227, 228, 3, 54, 27, 0, 228, 11, 1, 0, 0, 0, 229, 230, 5, 12, 0, 0, 230, 231, 3, 14, 7, 0, 231, 13, 1, 0, 0, 0, 232, 237, 3, 16, 8, 0, 233, 234, 5, 62, 0, 0, 234, 236, 3, 16, 8, 0, 235, 233, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 237, 238, 1, 0, 0, 0, 238, 15, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 240, 241, 3, 48, 24, 0, 241, 242, 5, 58, 0, 0, 242, 244, 1, 0, 0, 0, 243, 240, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 1, 0, 0, 0, 245, 246, 3, 130, 65, 0, 246, 17, 1, 0, 0, 0, 247, 252, 3, 20, 10, 0, 248, 249, 5, 62, 0, 0, 249, 251, 3, 20, 10, 0, 250, 248, 1, 0, 0, 0, 251, 254, 1, 0, 0, 0, 252, 250, 1, 0, 0, 0, 252, 253, 1, 0, 0, 0, 253, 19, 1, 0, 0, 0, 254, 252, 1, 0, 0, 0, 255, 258, 3, 48, 24, 0, 256, 257, 5, 58, 0, 0, 257, 259, 3, 130, 65, 0, 258, 256, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 21, 1, 0, 0, 0, 260, 261, 5, 19, 0, 0, 261, 262, 3, 26, 13, 0, 262, 23, 1, 0, 0, 0, 263, 264, 5, 20, 0, 0, 264, 265, 3, 26, 13, 0, 265, 25, 1, 0, 0, 0, 266, 271, 3, 28, 14, 0, 267, 268, 5, 62, 0, 0, 268, 270, 3, 28, 14, 0, 269, 267, 1, 0, 0, 0, 270, 273, 1, 0, 0, 0, 271, 269, 1, 0, 0, 0, 271, 272, 1, 0, 0, 0, 272, 275, 1, 0, 0, 0, 273, 271, 1, 0, 0, 0, 274, 276, 3, 38, 19, 0, 275, 274, 1, 0, 0, 0, 275, 276, 1, 0, 0, 0, 276, 27, 1, 0, 0, 0, 277, 278, 3, 30, 15, 0, 278, 279, 5, 61, 0, 0, 279, 280, 3, 34, 17, 0, 280, 287, 1, 0, 0, 0, 281, 282, 3, 34, 17, 0, 282, 283, 5, 60, 0, 0, 283, 284, 3, 32, 16, 0, 284, 287, 1, 0, 0, 0, 285, 287, 3, 36, 18, 0, 286, 277, 1, 0, 0, 0, 286, 281, 1, 0, 0, 0, 286, 285, 1, 0, 0, 0, 287, 29, 1, 0, 0, 0, 288, 289, 5, 107, 0, 0, 289, 31, 1, 0, 0, 0, 290, 291, 5, 107, 0, 0, 291, 33, 1, 0, 0, 0, 292, 293, 5, 107, 0, 0, 293, 35, 1, 0, 0, 0, 294, 295, 7, 0, 0, 0, 295, 37, 1, 0, 0, 0, 296, 297, 5, 106, 0, 0, 297, 302, 5, 107, 0, 0, 298, 299, 5, 62, 0, 0, 299, 301, 5, 107, 0, 0, 300, 298, 1, 0, 0, 0, 301, 304, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 39, 1, 0, 0, 0, 304, 302, 1, 0, 0, 0, 305, 306, 5, 9, 0, 0, 306, 307, 3, 14, 7, 0, 307, 41, 1, 0, 0, 0, 308, 310, 5, 15, 0, 0, 309, 311, 3, 44, 22, 0, 310, 309, 1, 0, 0, 0, 310, 311, 1, 0, 0, 0, 311, 314, 1, 0, 0, 0, 312, 313, 5, 59, 0, 0, 313, 315, 3, 14, 7, 0, 314, 312, 1, 0, 0, 0, 314, 315, 1, 0, 0, 0, 315, 43, 1, 0, 0, 0, 316, 321, 3, 46, 23, 0, 317, 318, 5, 62, 0, 0, 318, 320, 3, 46, 23, 0, 319, 317, 1, 0, 0, 0, 320, 323, 1, 0, 0, 0, 321, 319, 1, 0, 0, 0, 321, 322, 1, 0, 0, 0, 322, 45, 1, 0, 0, 0, 323, 321, 1, 0, 0, 0, 324, 327, 3, 16, 8, 0, 325, 326, 5, 16, 0, 0, 326, 328, 3, 130, 65, 0, 327, 325, 1, 0, 0, 0, 327, 328, 1, 0, 0, 0, 328, 47, 1, 0, 0, 0, 329, 334, 3, 62, 31, 0, 330, 331, 5, 64, 0, 0, 331, 333, 3, 62, 31, 0, 332, 330, 1, 0, 0, 0, 333, 336, 1, 0, 0, 0, 334, 332, 1, 0, 0, 0, 334, 335, 1, 0, 0, 0, 335, 49, 1, 0, 0, 0, 336, 334, 1, 0, 0, 0, 337, 342, 3, 56, 28, 0, 338, 339, 5, 64, 0, 0, 339, 341, 3, 56, 28, 0, 340, 338, 1, 0, 0, 0, 341, 344, 1, 0, 0, 0, 342, 340, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 51, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 345, 350, 3, 50, 25, 0, 346, 347, 5, 62, 0, 0, 347, 349, 3, 50, 25, 0, 348, 346, 1, 0, 0, 0, 349, 352, 1, 0, 0, 0, 350, 348, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, 53, 1, 0, 0, 0, 352, 350, 1, 0, 0, 0, 353, 354, 7, 1, 0, 0, 354, 55, 1, 0, 0, 0, 355, 359, 5, 128, 0, 0, 356, 359, 3, 58, 29, 0, 357, 359, 3, 60, 30, 0, 358, 355, 1, 0, 0, 0, 358, 356, 1, 0, 0, 0, 358, 357, 1, 0, 0, 0, 359, 57, 1, 0, 0, 0, 360, 363, 5, 76, 0, 0, 361, 363, 5, 95, 0, 0, 362, 360, 1, 0, 0, 0, 362, 361, 1, 0, 0, 0, 363, 59, 1, 0, 0, 0, 364, 367, 5, 94, 0, 0, 365, 367, 5, 96, 0, 0, 366, 364, 1, 0, 0, 0, 366, 365, 1, 0, 0, 0, 367, 61, 1, 0, 0, 0, 368, 372, 3, 54, 27, 0, 369, 372, 3, 58, 29, 0, 370, 372, 3, 60, 30, 0, 371, 368, 1, 0, 0, 0, 371, 369, 1, 0, 0, 0, 371, 370, 1, 0, 0, 0, 372, 63, 1, 0, 0, 0, 373, 374, 5, 11, 0, 0, 374, 375, 3, 150, 75, 0, 375, 65, 1, 0, 0, 0, 376, 377, 5, 14, 0, 0, 377, 382, 3, 68, 34, 0, 378, 379, 5, 62, 0, 0, 379, 381, 3, 68, 34, 0, 380, 378, 1, 0, 0, 0, 381, 384, 1, 0, 0, 0, 382, 380, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 67, 1, 0, 0, 0, 384, 382, 1, 0, 0, 0, 385, 387, 3, 130, 65, 0, 386, 388, 7, 2, 0, 0, 387, 386, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 391, 1, 0, 0, 0, 389, 390, 5, 73, 0, 0, 390, 392, 7, 3, 0, 0, 391, 389, 1, 0, 0, 0, 391, 392, 1, 0, 0, 0, 392, 69, 1, 0, 0, 0, 393, 394, 5, 29, 0, 0, 394, 395, 3, 52, 26, 0, 395, 71, 1, 0, 0, 0, 396, 397, 5, 28, 0, 0, 397, 398, 3, 52, 26, 0, 398, 73, 1, 0, 0, 0, 399, 400, 5, 32, 0, 0, 400, 405, 3, 76, 38, 0, 401, 402, 5, 62, 0, 0, 402, 404, 3, 76, 38, 0, 403, 401, 1, 0, 0, 0, 404, 407, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 405, 406, 1, 0, 0, 0, 406, 75, 1, 0, 0, 0, 407, 405, 1, 0, 0, 0, 408, 409, 3, 50, 25, 0, 409, 410, 5, 132, 0, 0, 410, 411, 3, 50, 25, 0, 411, 417, 1, 0, 0, 0, 412, 413, 3, 50, 25, 0, 413, 414, 5, 58, 0, 0, 414, 415, 3, 50, 25, 0, 415, 417, 1, 0, 0, 0, 416, 408, 1, 0, 0, 0, 416, 412, 1, 0, 0, 0, 417, 77, 1, 0, 0, 0, 418, 419, 5, 8, 0, 0, 419, 420, 3, 140, 70, 0, 420, 422, 3, 160, 80, 0, 421, 423, 3, 84, 42, 0, 422, 421, 1, 0, 0, 0, 422, 423, 1, 0, 0, 0, 423, 79, 1, 0, 0, 0, 424, 425, 5, 10, 0, 0, 425, 426, 3, 140, 70, 0, 426, 427, 3, 160, 80, 0, 427, 81, 1, 0, 0, 0, 428, 429, 5, 27, 0, 0, 429, 430, 3, 48, 24, 0, 430, 83, 1, 0, 0, 0, 431, 436, 3, 86, 43, 0, 432, 433, 5, 62, 0, 0, 433, 435, 3, 86, 43, 0, 434, 432, 1, 0, 0, 0, 435, 438, 1, 0, 0, 0, 436, 434, 1, 0, 0, 0, 436, 437, 1, 0, 0, 0, 437, 85, 1, 0, 0, 0, 438, 436, 1, 0, 0, 0, 439, 440, 3, 54, 27, 0, 440, 441, 5, 58, 0, 0, 441, 442, 3, 150, 75, 0, 442, 87, 1, 0, 0, 0, 443, 444, 5, 6, 0, 0, 444, 445, 3, 90, 45, 0, 445, 89, 1, 0, 0, 0, 446, 447, 5, 99, 0, 0, 447, 448, 3, 2, 1, 0, 448, 449, 5, 100, 0, 0, 449, 91, 1, 0, 0, 0, 450, 451, 5, 33, 0, 0, 451, 452, 5, 136, 0, 0, 452, 93, 1, 0, 0, 0, 453, 454, 5, 5, 0, 0, 454, 457, 5, 38, 0, 0, 455, 456, 5, 74, 0, 0, 456, 458, 3, 50, 25, 0, 457, 455, 1, 0, 0, 0, 457, 458, 1, 0, 0, 0, 458, 468, 1, 0, 0, 0, 459, 460, 5, 79, 0, 0, 460, 465, 3, 96, 48, 0, 461, 462, 5, 62, 0, 0, 462, 464, 3, 96, 48, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 468, 459, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 95, 1, 0, 0, 0, 470, 471, 3, 50, 25, 0, 471, 472, 5, 58, 0, 0, 472, 474, 1, 0, 0, 0, 473, 470, 1, 0, 0, 0, 473, 474, 1, 0, 0, 0, 474, 475, 1, 0, 0, 0, 475, 476, 3, 50, 25, 0, 476, 97, 1, 0, 0, 0, 477, 478, 5, 13, 0, 0, 478, 479, 3, 150, 75, 0, 479, 99, 1, 0, 0, 0, 480, 481, 5, 26, 0, 0, 481, 482, 3, 28, 14, 0, 482, 483, 5, 74, 0, 0, 483, 484, 3, 52, 26, 0, 484, 101, 1, 0, 0, 0, 485, 486, 5, 17, 0, 0, 486, 489, 3, 44, 22, 0, 487, 488, 5, 59, 0, 0, 488, 490, 3, 14, 7, 0, 489, 487, 1, 0, 0, 0, 489, 490, 1, 0, 0, 0, 490, 103, 1, 0, 0, 0, 491, 492, 5, 4, 0, 0, 492, 495, 3, 48, 24, 0, 493, 494, 5, 74, 0, 0, 494, 496, 3, 48, 24, 0, 495, 493, 1, 0, 0, 0, 495, 496, 1, 0, 0, 0, 496, 502, 1, 0, 0, 0, 497, 498, 5, 132, 0, 0, 498, 499, 3, 48, 24, 0, 499, 500, 5, 62, 0, 0, 500, 501, 3, 48, 24, 0, 501, 503, 1, 0, 0, 0, 502, 497, 1, 0, 0, 0, 502, 503, 1, 0, 0, 0, 503, 105, 1, 0, 0, 0, 504, 505, 5, 30, 0, 0, 505, 506, 3, 52, 26, 0, 506, 107, 1, 0, 0, 0, 507, 508, 5, 21, 0, 0, 508, 509, 3, 110, 55, 0, 509, 109, 1, 0, 0, 0, 510, 512, 3, 112, 56, 0, 511, 510, 1, 0, 0, 0, 512, 513, 1, 0, 0, 0, 513, 511, 1, 0, 0, 0, 513, 514, 1, 0, 0, 0, 514, 111, 1, 0, 0, 0, 515, 516, 5, 99, 0, 0, 516, 517, 3, 114, 57, 0, 517, 518, 5, 100, 0, 0, 518, 113, 1, 0, 0, 0, 519, 520, 6, 57, -1, 0, 520, 521, 3, 116, 58, 0, 521, 527, 1, 0, 0, 0, 522, 523, 10, 1, 0, 0, 523, 524, 5, 52, 0, 0, 524, 526, 3, 116, 58, 0, 525, 522, 1, 0, 0, 0, 526, 529, 1, 0, 0, 0, 527, 525, 1, 0, 0, 0, 527, 528, 1, 0, 0, 0, 528, 115, 1, 0, 0, 0, 529, 527, 1, 0, 0, 0, 530, 531, 3, 6, 3, 0, 531, 117, 1, 0, 0, 0, 532, 533, 5, 31, 0, 0, 533, 119, 1, 0, 0, 0, 534, 539, 3, 122, 61, 0, 535, 536, 5, 62, 0, 0, 536, 538, 3, 122, 61, 0, 537, 535, 1, 0, 0, 0, 538, 541, 1, 0, 0, 0, 539, 537, 1, 0, 0, 0, 539, 540, 1, 0, 0, 0, 540, 121, 1, 0, 0, 0, 541, 539, 1, 0, 0, 0, 542, 543, 3, 54, 27, 0, 543, 544, 5, 58, 0, 0, 544, 545, 3, 124, 62, 0, 545, 123, 1, 0, 0, 0, 546, 549, 3, 150, 75, 0, 547, 549, 3, 54, 27, 0, 548, 546, 1, 0, 0, 0, 548, 547, 1, 0, 0, 0, 549, 125, 1, 0, 0, 0, 550, 551, 5, 18, 0, 0, 551, 552, 3, 150, 75, 0, 552, 553, 5, 74, 0, 0, 553, 556, 3, 18, 9, 0, 554, 555, 5, 79, 0, 0, 555, 557, 3, 120, 60, 0, 556, 554, 1, 0, 0, 0, 556, 557, 1, 0, 0, 0, 557, 127, 1, 0, 0, 0, 558, 562, 5, 7, 0, 0, 559, 560, 3, 48, 24, 0, 560, 561, 5, 58, 0, 0, 561, 563, 1, 0, 0, 0, 562, 559, 1, 0, 0, 0, 562, 563, 1, 0, 0, 0, 563, 564, 1, 0, 0, 0, 564, 565, 3, 140, 70, 0, 565, 566, 5, 79, 0, 0, 566, 567, 3, 62, 31, 0, 567, 129, 1, 0, 0, 0, 568, 569, 6, 65, -1, 0, 569, 570, 5, 71, 0, 0, 570, 598, 3, 130, 65, 8, 571, 598, 3, 136, 68, 0, 572, 598, 3, 132, 66, 0, 573, 575, 3, 136, 68, 0, 574, 576, 5, 71, 0, 0, 575, 574, 1, 0, 0, 0, 575, 576, 1, 0, 0, 0, 576, 577, 1, 0, 0, 0, 577, 578, 5, 67, 0, 0, 578, 579, 5, 99, 0, 0, 579, 584, 3, 136, 68, 0, 580, 581, 5, 62, 0, 0, 581, 583, 3, 136, 68, 0, 582, 580, 1, 0, 0, 0, 583, 586, 1, 0, 0, 0, 584, 582, 1, 0, 0, 0, 584, 585, 1, 0, 0, 0, 585, 587, 1, 0, 0, 0, 586, 584, 1, 0, 0, 0, 587, 588, 5, 100, 0, 0, 588, 598, 1, 0, 0, 0, 589, 590, 3, 136, 68, 0, 590, 592, 5, 68, 0, 0, 591, 593, 5, 71, 0, 0, 592, 591, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 594, 1, 0, 0, 0, 594, 595, 5, 72, 0, 0, 595, 598, 1, 0, 0, 0, 596, 598, 3, 134, 67, 0, 597, 568, 1, 0, 0, 0, 597, 571, 1, 0, 0, 0, 597, 572, 1, 0, 0, 0, 597, 573, 1, 0, 0, 0, 597, 589, 1, 0, 0, 0, 597, 596, 1, 0, 0, 0, 598, 607, 1, 0, 0, 0, 599, 600, 10, 5, 0, 0, 600, 601, 5, 56, 0, 0, 601, 606, 3, 130, 65, 6, 602, 603, 10, 4, 0, 0, 603, 604, 5, 75, 0, 0, 604, 606, 3, 130, 65, 5, 605, 599, 1, 0, 0, 0, 605, 602, 1, 0, 0, 0, 606, 609, 1, 0, 0, 0, 607, 605, 1, 0, 0, 0, 607, 608, 1, 0, 0, 0, 608, 131, 1, 0, 0, 0, 609, 607, 1, 0, 0, 0, 610, 612, 3, 136, 68, 0, 611, 613, 5, 71, 0, 0, 612, 611, 1, 0, 0, 0, 612, 613, 1, 0, 0, 0, 613, 614, 1, 0, 0, 0, 614, 615, 5, 70, 0, 0, 615, 616, 3, 160, 80, 0, 616, 641, 1, 0, 0, 0, 617, 619, 3, 136, 68, 0, 618, 620, 5, 71, 0, 0, 619, 618, 1, 0, 0, 0, 619, 620, 1, 0, 0, 0, 620, 621, 1, 0, 0, 0, 621, 622, 5, 77, 0, 0, 622, 623, 3, 160, 80, 0, 623, 641, 1, 0, 0, 0, 624, 626, 3, 136, 68, 0, 625, 627, 5, 71, 0, 0, 626, 625, 1, 0, 0, 0, 626, 627, 1, 0, 0, 0, 627, 628, 1, 0, 0, 0, 628, 629, 5, 70, 0, 0, 629, 630, 5, 99, 0, 0, 630, 635, 3, 160, 80, 0, 631, 632, 5, 62, 0, 0, 632, 634, 3, 160, 80, 0, 633, 631, 1, 0, 0, 0, 634, 637, 1, 0, 0, 0, 635, 633, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 638, 1, 0, 0, 0, 637, 635, 1, 0, 0, 0, 638, 639, 5, 100, 0, 0, 639, 641, 1, 0, 0, 0, 640, 610, 1, 0, 0, 0, 640, 617, 1, 0, 0, 0, 640, 624, 1, 0, 0, 0, 641, 133, 1, 0, 0, 0, 642, 645, 3, 48, 24, 0, 643, 644, 5, 60, 0, 0, 644, 646, 3, 10, 5, 0, 645, 643, 1, 0, 0, 0, 645, 646, 1, 0, 0, 0, 646, 647, 1, 0, 0, 0, 647, 648, 5, 61, 0, 0, 648, 649, 3, 150, 75, 0, 649, 135, 1, 0, 0, 0, 650, 656, 3, 138, 69, 0, 651, 652, 3, 138, 69, 0, 652, 653, 3, 162, 81, 0, 653, 654, 3, 138, 69, 0, 654, 656, 1, 0, 0, 0, 655, 650, 1, 0, 0, 0, 655, 651, 1, 0, 0, 0, 656, 137, 1, 0, 0, 0, 657, 658, 6, 69, -1, 0, 658, 662, 3, 140, 70, 0, 659, 660, 7, 4, 0, 0, 660, 662, 3, 138, 69, 3, 661, 657, 1, 0, 0, 0, 661, 659, 1, 0, 0, 0, 662, 671, 1, 0, 0, 0, 663, 664, 10, 2, 0, 0, 664, 665, 7, 5, 0, 0, 665, 670, 3, 138, 69, 3, 666, 667, 10, 1, 0, 0, 667, 668, 7, 4, 0, 0, 668, 670, 3, 138, 69, 2, 669, 663, 1, 0, 0, 0, 669, 666, 1, 0, 0, 0, 670, 673, 1, 0, 0, 0, 671, 669, 1, 0, 0, 0, 671, 672, 1, 0, 0, 0, 672, 139, 1, 0, 0, 0, 673, 671, 1, 0, 0, 0, 674, 675, 6, 70, -1, 0, 675, 683, 3, 150, 75, 0, 676, 683, 3, 48, 24, 0, 677, 683, 3, 142, 71, 0, 678, 679, 5, 99, 0, 0, 679, 680, 3, 130, 65, 0, 680, 681, 5, 100, 0, 0, 681, 683, 1, 0, 0, 0, 682, 674, 1, 0, 0, 0, 682, 676, 1, 0, 0, 0, 682, 677, 1, 0, 0, 0, 682, 678, 1, 0, 0, 0, 683, 689, 1, 0, 0, 0, 684, 685, 10, 1, 0, 0, 685, 686, 5, 60, 0, 0, 686, 688, 3, 10, 5, 0, 687, 684, 1, 0, 0, 0, 688, 691, 1, 0, 0, 0, 689, 687, 1, 0, 0, 0, 689, 690, 1, 0, 0, 0, 690, 141, 1, 0, 0, 0, 691, 689, 1, 0, 0, 0, 692, 693, 3, 144, 72, 0, 693, 707, 5, 99, 0, 0, 694, 708, 5, 89, 0, 0, 695, 700, 3, 130, 65, 0, 696, 697, 5, 62, 0, 0, 697, 699, 3, 130, 65, 0, 698, 696, 1, 0, 0, 0, 699, 702, 1, 0, 0, 0, 700, 698, 1, 0, 0, 0, 700, 701, 1, 0, 0, 0, 701, 705, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 703, 704, 5, 62, 0, 0, 704, 706, 3, 146, 73, 0, 705, 703, 1, 0, 0, 0, 705, 706, 1, 0, 0, 0, 706, 708, 1, 0, 0, 0, 707, 694, 1, 0, 0, 0, 707, 695, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 5, 100, 0, 0, 710, 143, 1, 0, 0, 0, 711, 712, 3, 62, 31, 0, 712, 145, 1, 0, 0, 0, 713, 714, 5, 92, 0, 0, 714, 719, 3, 148, 74, 0, 715, 716, 5, 62, 0, 0, 716, 718, 3, 148, 74, 0, 717, 715, 1, 0, 0, 0, 718, 721, 1, 0, 0, 0, 719, 717, 1, 0, 0, 0, 719, 720, 1, 0, 0, 0, 720, 722, 1, 0, 0, 0, 721, 719, 1, 0, 0, 0, 722, 723, 5, 93, 0, 0, 723, 147, 1, 0, 0, 0, 724, 725, 3, 160, 80, 0, 725, 726, 5, 61, 0, 0, 726, 727, 3, 150, 75, 0, 727, 149, 1, 0, 0, 0, 728, 771, 5, 72, 0, 0, 729, 730, 3, 158, 79, 0, 730, 731, 5, 101, 0, 0, 731, 771, 1, 0, 0, 0, 732, 771, 3, 156, 78, 0, 733, 771, 3, 158, 79, 0, 734, 771, 3, 152, 76, 0, 735, 771, 3, 58, 29, 0, 736, 771, 3, 160, 80, 0, 737, 738, 5, 97, 0, 0, 738, 743, 3, 154, 77, 0, 739, 740, 5, 62, 0, 0, 740, 742, 3, 154, 77, 0, 741, 739, 1, 0, 0, 0, 742, 745, 1, 0, 0, 0, 743, 741, 1, 0, 0, 0, 743, 744, 1, 0, 0, 0, 744, 746, 1, 0, 0, 0, 745, 743, 1, 0, 0, 0, 746, 747, 5, 98, 0, 0, 747, 771, 1, 0, 0, 0, 748, 749, 5, 97, 0, 0, 749, 754, 3, 152, 76, 0, 750, 751, 5, 62, 0, 0, 751, 753, 3, 152, 76, 0, 752, 750, 1, 0, 0, 0, 753, 756, 1, 0, 0, 0, 754, 752, 1, 0, 0, 0, 754, 755, 1, 0, 0, 0, 755, 757, 1, 0, 0, 0, 756, 754, 1, 0, 0, 0, 757, 758, 5, 98, 0, 0, 758, 771, 1, 0, 0, 0, 759, 760, 5, 97, 0, 0, 760, 765, 3, 160, 80, 0, 761, 762, 5, 62, 0, 0, 762, 764, 3, 160, 80, 0, 763, 761, 1, 0, 0, 0, 764, 767, 1, 0, 0, 0, 765, 763, 1, 0, 0, 0, 765, 766, 1, 0, 0, 0, 766, 768, 1, 0, 0, 0, 767, 765, 1, 0, 0, 0, 768, 769, 5, 98, 0, 0, 769, 771, 1, 0, 0, 0, 770, 728, 1, 0, 0, 0, 770, 729, 1, 0, 0, 0, 770, 732, 1, 0, 0, 0, 770, 733, 1, 0, 0, 0, 770, 734, 1, 0, 0, 0, 770, 735, 1, 0, 0, 0, 770, 736, 1, 0, 0, 0, 770, 737, 1, 0, 0, 0, 770, 748, 1, 0, 0, 0, 770, 759, 1, 0, 0, 0, 771, 151, 1, 0, 0, 0, 772, 773, 7, 6, 0, 0, 773, 153, 1, 0, 0, 0, 774, 777, 3, 156, 78, 0, 775, 777, 3, 158, 79, 0, 776, 774, 1, 0, 0, 0, 776, 775, 1, 0, 0, 0, 777, 155, 1, 0, 0, 0, 778, 780, 7, 4, 0, 0, 779, 778, 1, 0, 0, 0, 779, 780, 1, 0, 0, 0, 780, 781, 1, 0, 0, 0, 781, 782, 5, 55, 0, 0, 782, 157, 1, 0, 0, 0, 783, 785, 7, 4, 0, 0, 784, 783, 1, 0, 0, 0, 784, 785, 1, 0, 0, 0, 785, 786, 1, 0, 0, 0, 786, 787, 5, 54, 0, 0, 787, 159, 1, 0, 0, 0, 788, 789, 5, 53, 0, 0, 789, 161, 1, 0, 0, 0, 790, 791, 7, 7, 0, 0, 791, 163, 1, 0, 0, 0, 792, 793, 7, 8, 0, 0, 793, 794, 5, 114, 0, 0, 794, 795, 3, 166, 83, 0, 795, 796, 3, 168, 84, 0, 796, 165, 1, 0, 0, 0, 797, 798, 3, 28, 14, 0, 798, 167, 1, 0, 0, 0, 799, 800, 5, 74, 0, 0, 800, 805, 3, 170, 85, 0, 801, 802, 5, 62, 0, 0, 802, 804, 3, 170, 85, 0, 803, 801, 1, 0, 0, 0, 804, 807, 1, 0, 0, 0, 805, 803, 1, 0, 0, 0, 805, 806, 1, 0, 0, 0, 806, 169, 1, 0, 0, 0, 807, 805, 1, 0, 0, 0, 808, 809, 3, 136, 68, 0, 809, 171, 1, 0, 0, 0, 72, 183, 193, 222, 237, 243, 252, 258, 271, 275, 286, 302, 310, 314, 321, 327, 334, 342, 350, 358, 362, 366, 371, 382, 387, 391, 405, 416, 422, 436, 457, 465, 468, 473, 489, 495, 502, 513, 527, 539, 548, 556, 562, 575, 584, 592, 597, 605, 607, 612, 619, 626, 635, 640, 645, 655, 661, 669, 671, 682, 689, 700, 705, 707, 719, 743, 754, 765, 770, 776, 779, 784, 805]
\ No newline at end of file
+<<<<<<< HEAD
+[4, 1, 139, 811, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 182, 8, 1, 10, 1, 12, 1, 185, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 194, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 223, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 236, 8, 7, 10, 7, 12, 7, 239, 9, 7, 1, 8, 1, 8, 1, 8, 3, 8, 244, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 5, 9, 251, 8, 9, 10, 9, 12, 9, 254, 9, 9, 1, 10, 1, 10, 1, 10, 3, 10, 259, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 5, 13, 270, 8, 13, 10, 13, 12, 13, 273, 9, 13, 1, 13, 3, 13, 276, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 287, 8, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 301, 8, 19, 10, 19, 12, 19, 304, 9, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 3, 21, 311, 8, 21, 1, 21, 1, 21, 3, 21, 315, 8, 21, 1, 22, 1, 22, 1, 22, 5, 22, 320, 8, 22, 10, 22, 12, 22, 323, 9, 22, 1, 23, 1, 23, 1, 23, 3, 23, 328, 8, 23, 1, 24, 1, 24, 1, 24, 5, 24, 333, 8, 24, 10, 24, 12, 24, 336, 9, 24, 1, 25, 1, 25, 1, 25, 5, 25, 341, 8, 25, 10, 25, 12, 25, 344, 9, 25, 1, 26, 1, 26, 1, 26, 5, 26, 349, 8, 26, 10, 26, 12, 26, 352, 9, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 3, 28, 359, 8, 28, 1, 29, 1, 29, 3, 29, 363, 8, 29, 1, 30, 1, 30, 3, 30, 367, 8, 30, 1, 31, 1, 31, 1, 31, 3, 31, 372, 8, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 5, 33, 381, 8, 33, 10, 33, 12, 33, 384, 9, 33, 1, 34, 1, 34, 3, 34, 388, 8, 34, 1, 34, 1, 34, 3, 34, 392, 8, 34, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 404, 8, 37, 10, 37, 12, 37, 407, 9, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 417, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 423, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 5, 42, 435, 8, 42, 10, 42, 12, 42, 438, 9, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 3, 47, 458, 8, 47, 1, 47, 1, 47, 1, 47, 1, 47, 5, 47, 464, 8, 47, 10, 47, 12, 47, 467, 9, 47, 3, 47, 469, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 474, 8, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 490, 8, 51, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 496, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 503, 8, 52, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 55, 4, 55, 512, 8, 55, 11, 55, 12, 55, 513, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 5, 57, 526, 8, 57, 10, 57, 12, 57, 529, 9, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 5, 60, 538, 8, 60, 10, 60, 12, 60, 541, 9, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 3, 62, 549, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 557, 8, 63, 1, 64, 1, 64, 1, 64, 1, 64, 3, 64, 563, 8, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 3, 65, 576, 8, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 583, 8, 65, 10, 65, 12, 65, 586, 9, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 3, 65, 593, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 598, 8, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 606, 8, 65, 10, 65, 12, 65, 609, 9, 65, 1, 66, 1, 66, 3, 66, 613, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 620, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 627, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 5, 66, 634, 8, 66, 10, 66, 12, 66, 637, 9, 66, 1, 66, 1, 66, 3, 66, 641, 8, 66, 1, 67, 1, 67, 1, 67, 3, 67, 646, 8, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 656, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 662, 8, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 5, 69, 670, 8, 69, 10, 69, 12, 69, 673, 9, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 3, 70, 683, 8, 70, 1, 70, 1, 70, 1, 70, 5, 70, 688, 8, 70, 10, 70, 12, 70, 691, 9, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 5, 71, 699, 8, 71, 10, 71, 12, 71, 702, 9, 71, 1, 71, 1, 71, 3, 71, 706, 8, 71, 3, 71, 708, 8, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 5, 73, 718, 8, 73, 10, 73, 12, 73, 721, 9, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 742, 8, 75, 10, 75, 12, 75, 745, 9, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 753, 8, 75, 10, 75, 12, 75, 756, 9, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 764, 8, 75, 10, 75, 12, 75, 767, 9, 75, 1, 75, 1, 75, 3, 75, 771, 8, 75, 1, 76, 1, 76, 1, 77, 1, 77, 3, 77, 777, 8, 77, 1, 78, 3, 78, 780, 8, 78, 1, 78, 1, 78, 1, 79, 3, 79, 785, 8, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 5, 84, 804, 8, 84, 10, 84, 12, 84, 807, 9, 84, 1, 85, 1, 85, 1, 85, 0, 5, 2, 114, 130, 138, 140, 86, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 0, 9, 2, 0, 53, 53, 107, 107, 1, 0, 101, 102, 2, 0, 57, 57, 63, 63, 2, 0, 66, 66, 69, 69, 1, 0, 87, 88, 1, 0, 89, 91, 2, 0, 65, 65, 78, 78, 2, 0, 80, 80, 82, 86, 2, 0, 22, 22, 24, 25, 838, 0, 172, 1, 0, 0, 0, 2, 175, 1, 0, 0, 0, 4, 193, 1, 0, 0, 0, 6, 222, 1, 0, 0, 0, 8, 224, 1, 0, 0, 0, 10, 227, 1, 0, 0, 0, 12, 229, 1, 0, 0, 0, 14, 232, 1, 0, 0, 0, 16, 243, 1, 0, 0, 0, 18, 247, 1, 0, 0, 0, 20, 255, 1, 0, 0, 0, 22, 260, 1, 0, 0, 0, 24, 263, 1, 0, 0, 0, 26, 266, 1, 0, 0, 0, 28, 286, 1, 0, 0, 0, 30, 288, 1, 0, 0, 0, 32, 290, 1, 0, 0, 0, 34, 292, 1, 0, 0, 0, 36, 294, 1, 0, 0, 0, 38, 296, 1, 0, 0, 0, 40, 305, 1, 0, 0, 0, 42, 308, 1, 0, 0, 0, 44, 316, 1, 0, 0, 0, 46, 324, 1, 0, 0, 0, 48, 329, 1, 0, 0, 0, 50, 337, 1, 0, 0, 0, 52, 345, 1, 0, 0, 0, 54, 353, 1, 0, 0, 0, 56, 358, 1, 0, 0, 0, 58, 362, 1, 0, 0, 0, 60, 366, 1, 0, 0, 0, 62, 371, 1, 0, 0, 0, 64, 373, 1, 0, 0, 0, 66, 376, 1, 0, 0, 0, 68, 385, 1, 0, 0, 0, 70, 393, 1, 0, 0, 0, 72, 396, 1, 0, 0, 0, 74, 399, 1, 0, 0, 0, 76, 416, 1, 0, 0, 0, 78, 418, 1, 0, 0, 0, 80, 424, 1, 0, 0, 0, 82, 428, 1, 0, 0, 0, 84, 431, 1, 0, 0, 0, 86, 439, 1, 0, 0, 0, 88, 443, 1, 0, 0, 0, 90, 446, 1, 0, 0, 0, 92, 450, 1, 0, 0, 0, 94, 453, 1, 0, 0, 0, 96, 473, 1, 0, 0, 0, 98, 477, 1, 0, 0, 0, 100, 480, 1, 0, 0, 0, 102, 485, 1, 0, 0, 0, 104, 491, 1, 0, 0, 0, 106, 504, 1, 0, 0, 0, 108, 507, 1, 0, 0, 0, 110, 511, 1, 0, 0, 0, 112, 515, 1, 0, 0, 0, 114, 519, 1, 0, 0, 0, 116, 530, 1, 0, 0, 0, 118, 532, 1, 0, 0, 0, 120, 534, 1, 0, 0, 0, 122, 542, 1, 0, 0, 0, 124, 548, 1, 0, 0, 0, 126, 550, 1, 0, 0, 0, 128, 558, 1, 0, 0, 0, 130, 597, 1, 0, 0, 0, 132, 640, 1, 0, 0, 0, 134, 642, 1, 0, 0, 0, 136, 655, 1, 0, 0, 0, 138, 661, 1, 0, 0, 0, 140, 682, 1, 0, 0, 0, 142, 692, 1, 0, 0, 0, 144, 711, 1, 0, 0, 0, 146, 713, 1, 0, 0, 0, 148, 724, 1, 0, 0, 0, 150, 770, 1, 0, 0, 0, 152, 772, 1, 0, 0, 0, 154, 776, 1, 0, 0, 0, 156, 779, 1, 0, 0, 0, 158, 784, 1, 0, 0, 0, 160, 788, 1, 0, 0, 0, 162, 790, 1, 0, 0, 0, 164, 792, 1, 0, 0, 0, 166, 797, 1, 0, 0, 0, 168, 799, 1, 0, 0, 0, 170, 808, 1, 0, 0, 0, 172, 173, 3, 2, 1, 0, 173, 174, 5, 0, 0, 1, 174, 1, 1, 0, 0, 0, 175, 176, 6, 1, -1, 0, 176, 177, 3, 4, 2, 0, 177, 183, 1, 0, 0, 0, 178, 179, 10, 1, 0, 0, 179, 180, 5, 52, 0, 0, 180, 182, 3, 6, 3, 0, 181, 178, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 3, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 194, 3, 22, 11, 0, 187, 194, 3, 12, 6, 0, 188, 194, 3, 92, 46, 0, 189, 190, 4, 2, 1, 0, 190, 194, 3, 24, 12, 0, 191, 192, 4, 2, 2, 0, 192, 194, 3, 88, 44, 0, 193, 186, 1, 0, 0, 0, 193, 187, 1, 0, 0, 0, 193, 188, 1, 0, 0, 0, 193, 189, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 194, 5, 1, 0, 0, 0, 195, 223, 3, 40, 20, 0, 196, 223, 3, 8, 4, 0, 197, 223, 3, 70, 35, 0, 198, 223, 3, 64, 32, 0, 199, 223, 3, 42, 21, 0, 200, 223, 3, 66, 33, 0, 201, 223, 3, 72, 36, 0, 202, 223, 3, 74, 37, 0, 203, 223, 3, 78, 39, 0, 204, 223, 3, 80, 40, 0, 205, 223, 3, 94, 47, 0, 206, 223, 3, 82, 41, 0, 207, 223, 3, 164, 82, 0, 208, 223, 3, 104, 52, 0, 209, 223, 3, 128, 64, 0, 210, 223, 3, 98, 49, 0, 211, 223, 3, 108, 54, 0, 212, 213, 4, 3, 3, 0, 213, 223, 3, 102, 51, 0, 214, 215, 4, 3, 4, 0, 215, 223, 3, 100, 50, 0, 216, 217, 4, 3, 5, 0, 217, 223, 3, 106, 53, 0, 218, 219, 4, 3, 6, 0, 219, 223, 3, 126, 63, 0, 220, 221, 4, 3, 7, 0, 221, 223, 3, 118, 59, 0, 222, 195, 1, 0, 0, 0, 222, 196, 1, 0, 0, 0, 222, 197, 1, 0, 0, 0, 222, 198, 1, 0, 0, 0, 222, 199, 1, 0, 0, 0, 222, 200, 1, 0, 0, 0, 222, 201, 1, 0, 0, 0, 222, 202, 1, 0, 0, 0, 222, 203, 1, 0, 0, 0, 222, 204, 1, 0, 0, 0, 222, 205, 1, 0, 0, 0, 222, 206, 1, 0, 0, 0, 222, 207, 1, 0, 0, 0, 222, 208, 1, 0, 0, 0, 222, 209, 1, 0, 0, 0, 222, 210, 1, 0, 0, 0, 222, 211, 1, 0, 0, 0, 222, 212, 1, 0, 0, 0, 222, 214, 1, 0, 0, 0, 222, 216, 1, 0, 0, 0, 222, 218, 1, 0, 0, 0, 222, 220, 1, 0, 0, 0, 223, 7, 1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 130, 65, 0, 226, 9, 1, 0, 0, 0, 227, 228, 3, 54, 27, 0, 228, 11, 1, 0, 0, 0, 229, 230, 5, 12, 0, 0, 230, 231, 3, 14, 7, 0, 231, 13, 1, 0, 0, 0, 232, 237, 3, 16, 8, 0, 233, 234, 5, 62, 0, 0, 234, 236, 3, 16, 8, 0, 235, 233, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 237, 238, 1, 0, 0, 0, 238, 15, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 240, 241, 3, 48, 24, 0, 241, 242, 5, 58, 0, 0, 242, 244, 1, 0, 0, 0, 243, 240, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 1, 0, 0, 0, 245, 246, 3, 130, 65, 0, 246, 17, 1, 0, 0, 0, 247, 252, 3, 20, 10, 0, 248, 249, 5, 62, 0, 0, 249, 251, 3, 20, 10, 0, 250, 248, 1, 0, 0, 0, 251, 254, 1, 0, 0, 0, 252, 250, 1, 0, 0, 0, 252, 253, 1, 0, 0, 0, 253, 19, 1, 0, 0, 0, 254, 252, 1, 0, 0, 0, 255, 258, 3, 48, 24, 0, 256, 257, 5, 58, 0, 0, 257, 259, 3, 130, 65, 0, 258, 256, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 21, 1, 0, 0, 0, 260, 261, 5, 19, 0, 0, 261, 262, 3, 26, 13, 0, 262, 23, 1, 0, 0, 0, 263, 264, 5, 20, 0, 0, 264, 265, 3, 26, 13, 0, 265, 25, 1, 0, 0, 0, 266, 271, 3, 28, 14, 0, 267, 268, 5, 62, 0, 0, 268, 270, 3, 28, 14, 0, 269, 267, 1, 0, 0, 0, 270, 273, 1, 0, 0, 0, 271, 269, 1, 0, 0, 0, 271, 272, 1, 0, 0, 0, 272, 275, 1, 0, 0, 0, 273, 271, 1, 0, 0, 0, 274, 276, 3, 38, 19, 0, 275, 274, 1, 0, 0, 0, 275, 276, 1, 0, 0, 0, 276, 27, 1, 0, 0, 0, 277, 278, 3, 30, 15, 0, 278, 279, 5, 61, 0, 0, 279, 280, 3, 34, 17, 0, 280, 287, 1, 0, 0, 0, 281, 282, 3, 34, 17, 0, 282, 283, 5, 60, 0, 0, 283, 284, 3, 32, 16, 0, 284, 287, 1, 0, 0, 0, 285, 287, 3, 36, 18, 0, 286, 277, 1, 0, 0, 0, 286, 281, 1, 0, 0, 0, 286, 285, 1, 0, 0, 0, 287, 29, 1, 0, 0, 0, 288, 289, 5, 107, 0, 0, 289, 31, 1, 0, 0, 0, 290, 291, 5, 107, 0, 0, 291, 33, 1, 0, 0, 0, 292, 293, 5, 107, 0, 0, 293, 35, 1, 0, 0, 0, 294, 295, 7, 0, 0, 0, 295, 37, 1, 0, 0, 0, 296, 297, 5, 106, 0, 0, 297, 302, 5, 107, 0, 0, 298, 299, 5, 62, 0, 0, 299, 301, 5, 107, 0, 0, 300, 298, 1, 0, 0, 0, 301, 304, 1, 0, 0, 0, 302, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 39, 1, 0, 0, 0, 304, 302, 1, 0, 0, 0, 305, 306, 5, 9, 0, 0, 306, 307, 3, 14, 7, 0, 307, 41, 1, 0, 0, 0, 308, 310, 5, 15, 0, 0, 309, 311, 3, 44, 22, 0, 310, 309, 1, 0, 0, 0, 310, 311, 1, 0, 0, 0, 311, 314, 1, 0, 0, 0, 312, 313, 5, 59, 0, 0, 313, 315, 3, 14, 7, 0, 314, 312, 1, 0, 0, 0, 314, 315, 1, 0, 0, 0, 315, 43, 1, 0, 0, 0, 316, 321, 3, 46, 23, 0, 317, 318, 5, 62, 0, 0, 318, 320, 3, 46, 23, 0, 319, 317, 1, 0, 0, 0, 320, 323, 1, 0, 0, 0, 321, 319, 1, 0, 0, 0, 321, 322, 1, 0, 0, 0, 322, 45, 1, 0, 0, 0, 323, 321, 1, 0, 0, 0, 324, 327, 3, 16, 8, 0, 325, 326, 5, 16, 0, 0, 326, 328, 3, 130, 65, 0, 327, 325, 1, 0, 0, 0, 327, 328, 1, 0, 0, 0, 328, 47, 1, 0, 0, 0, 329, 334, 3, 62, 31, 0, 330, 331, 5, 64, 0, 0, 331, 333, 3, 62, 31, 0, 332, 330, 1, 0, 0, 0, 333, 336, 1, 0, 0, 0, 334, 332, 1, 0, 0, 0, 334, 335, 1, 0, 0, 0, 335, 49, 1, 0, 0, 0, 336, 334, 1, 0, 0, 0, 337, 342, 3, 56, 28, 0, 338, 339, 5, 64, 0, 0, 339, 341, 3, 56, 28, 0, 340, 338, 1, 0, 0, 0, 341, 344, 1, 0, 0, 0, 342, 340, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 51, 1, 0, 0, 0, 344, 342, 1, 0, 0, 0, 345, 350, 3, 50, 25, 0, 346, 347, 5, 62, 0, 0, 347, 349, 3, 50, 25, 0, 348, 346, 1, 0, 0, 0, 349, 352, 1, 0, 0, 0, 350, 348, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, 53, 1, 0, 0, 0, 352, 350, 1, 0, 0, 0, 353, 354, 7, 1, 0, 0, 354, 55, 1, 0, 0, 0, 355, 359, 5, 128, 0, 0, 356, 359, 3, 58, 29, 0, 357, 359, 3, 60, 30, 0, 358, 355, 1, 0, 0, 0, 358, 356, 1, 0, 0, 0, 358, 357, 1, 0, 0, 0, 359, 57, 1, 0, 0, 0, 360, 363, 5, 76, 0, 0, 361, 363, 5, 95, 0, 0, 362, 360, 1, 0, 0, 0, 362, 361, 1, 0, 0, 0, 363, 59, 1, 0, 0, 0, 364, 367, 5, 94, 0, 0, 365, 367, 5, 96, 0, 0, 366, 364, 1, 0, 0, 0, 366, 365, 1, 0, 0, 0, 367, 61, 1, 0, 0, 0, 368, 372, 3, 54, 27, 0, 369, 372, 3, 58, 29, 0, 370, 372, 3, 60, 30, 0, 371, 368, 1, 0, 0, 0, 371, 369, 1, 0, 0, 0, 371, 370, 1, 0, 0, 0, 372, 63, 1, 0, 0, 0, 373, 374, 5, 11, 0, 0, 374, 375, 3, 150, 75, 0, 375, 65, 1, 0, 0, 0, 376, 377, 5, 14, 0, 0, 377, 382, 3, 68, 34, 0, 378, 379, 5, 62, 0, 0, 379, 381, 3, 68, 34, 0, 380, 378, 1, 0, 0, 0, 381, 384, 1, 0, 0, 0, 382, 380, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 67, 1, 0, 0, 0, 384, 382, 1, 0, 0, 0, 385, 387, 3, 130, 65, 0, 386, 388, 7, 2, 0, 0, 387, 386, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 391, 1, 0, 0, 0, 389, 390, 5, 73, 0, 0, 390, 392, 7, 3, 0, 0, 391, 389, 1, 0, 0, 0, 391, 392, 1, 0, 0, 0, 392, 69, 1, 0, 0, 0, 393, 394, 5, 29, 0, 0, 394, 395, 3, 52, 26, 0, 395, 71, 1, 0, 0, 0, 396, 397, 5, 28, 0, 0, 397, 398, 3, 52, 26, 0, 398, 73, 1, 0, 0, 0, 399, 400, 5, 32, 0, 0, 400, 405, 3, 76, 38, 0, 401, 402, 5, 62, 0, 0, 402, 404, 3, 76, 38, 0, 403, 401, 1, 0, 0, 0, 404, 407, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 405, 406, 1, 0, 0, 0, 406, 75, 1, 0, 0, 0, 407, 405, 1, 0, 0, 0, 408, 409, 3, 50, 25, 0, 409, 410, 5, 132, 0, 0, 410, 411, 3, 50, 25, 0, 411, 417, 1, 0, 0, 0, 412, 413, 3, 50, 25, 0, 413, 414, 5, 58, 0, 0, 414, 415, 3, 50, 25, 0, 415, 417, 1, 0, 0, 0, 416, 408, 1, 0, 0, 0, 416, 412, 1, 0, 0, 0, 417, 77, 1, 0, 0, 0, 418, 419, 5, 8, 0, 0, 419, 420, 3, 140, 70, 0, 420, 422, 3, 160, 80, 0, 421, 423, 3, 84, 42, 0, 422, 421, 1, 0, 0, 0, 422, 423, 1, 0, 0, 0, 423, 79, 1, 0, 0, 0, 424, 425, 5, 10, 0, 0, 425, 426, 3, 140, 70, 0, 426, 427, 3, 160, 80, 0, 427, 81, 1, 0, 0, 0, 428, 429, 5, 27, 0, 0, 429, 430, 3, 48, 24, 0, 430, 83, 1, 0, 0, 0, 431, 436, 3, 86, 43, 0, 432, 433, 5, 62, 0, 0, 433, 435, 3, 86, 43, 0, 434, 432, 1, 0, 0, 0, 435, 438, 1, 0, 0, 0, 436, 434, 1, 0, 0, 0, 436, 437, 1, 0, 0, 0, 437, 85, 1, 0, 0, 0, 438, 436, 1, 0, 0, 0, 439, 440, 3, 54, 27, 0, 440, 441, 5, 58, 0, 0, 441, 442, 3, 150, 75, 0, 442, 87, 1, 0, 0, 0, 443, 444, 5, 6, 0, 0, 444, 445, 3, 90, 45, 0, 445, 89, 1, 0, 0, 0, 446, 447, 5, 99, 0, 0, 447, 448, 3, 2, 1, 0, 448, 449, 5, 100, 0, 0, 449, 91, 1, 0, 0, 0, 450, 451, 5, 33, 0, 0, 451, 452, 5, 136, 0, 0, 452, 93, 1, 0, 0, 0, 453, 454, 5, 5, 0, 0, 454, 457, 5, 38, 0, 0, 455, 456, 5, 74, 0, 0, 456, 458, 3, 50, 25, 0, 457, 455, 1, 0, 0, 0, 457, 458, 1, 0, 0, 0, 458, 468, 1, 0, 0, 0, 459, 460, 5, 79, 0, 0, 460, 465, 3, 96, 48, 0, 461, 462, 5, 62, 0, 0, 462, 464, 3, 96, 48, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 468, 459, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 95, 1, 0, 0, 0, 470, 471, 3, 50, 25, 0, 471, 472, 5, 58, 0, 0, 472, 474, 1, 0, 0, 0, 473, 470, 1, 0, 0, 0, 473, 474, 1, 0, 0, 0, 474, 475, 1, 0, 0, 0, 475, 476, 3, 50, 25, 0, 476, 97, 1, 0, 0, 0, 477, 478, 5, 13, 0, 0, 478, 479, 3, 150, 75, 0, 479, 99, 1, 0, 0, 0, 480, 481, 5, 26, 0, 0, 481, 482, 3, 28, 14, 0, 482, 483, 5, 74, 0, 0, 483, 484, 3, 52, 26, 0, 484, 101, 1, 0, 0, 0, 485, 486, 5, 17, 0, 0, 486, 489, 3, 44, 22, 0, 487, 488, 5, 59, 0, 0, 488, 490, 3, 14, 7, 0, 489, 487, 1, 0, 0, 0, 489, 490, 1, 0, 0, 0, 490, 103, 1, 0, 0, 0, 491, 492, 5, 4, 0, 0, 492, 495, 3, 48, 24, 0, 493, 494, 5, 74, 0, 0, 494, 496, 3, 48, 24, 0, 495, 493, 1, 0, 0, 0, 495, 496, 1, 0, 0, 0, 496, 502, 1, 0, 0, 0, 497, 498, 5, 132, 0, 0, 498, 499, 3, 48, 24, 0, 499, 500, 5, 62, 0, 0, 500, 501, 3, 48, 24, 0, 501, 503, 1, 0, 0, 0, 502, 497, 1, 0, 0, 0, 502, 503, 1, 0, 0, 0, 503, 105, 1, 0, 0, 0, 504, 505, 5, 30, 0, 0, 505, 506, 3, 52, 26, 0, 506, 107, 1, 0, 0, 0, 507, 508, 5, 21, 0, 0, 508, 509, 3, 110, 55, 0, 509, 109, 1, 0, 0, 0, 510, 512, 3, 112, 56, 0, 511, 510, 1, 0, 0, 0, 512, 513, 1, 0, 0, 0, 513, 511, 1, 0, 0, 0, 513, 514, 1, 0, 0, 0, 514, 111, 1, 0, 0, 0, 515, 516, 5, 99, 0, 0, 516, 517, 3, 114, 57, 0, 517, 518, 5, 100, 0, 0, 518, 113, 1, 0, 0, 0, 519, 520, 6, 57, -1, 0, 520, 521, 3, 116, 58, 0, 521, 527, 1, 0, 0, 0, 522, 523, 10, 1, 0, 0, 523, 524, 5, 52, 0, 0, 524, 526, 3, 116, 58, 0, 525, 522, 1, 0, 0, 0, 526, 529, 1, 0, 0, 0, 527, 525, 1, 0, 0, 0, 527, 528, 1, 0, 0, 0, 528, 115, 1, 0, 0, 0, 529, 527, 1, 0, 0, 0, 530, 531, 3, 6, 3, 0, 531, 117, 1, 0, 0, 0, 532, 533, 5, 31, 0, 0, 533, 119, 1, 0, 0, 0, 534, 539, 3, 122, 61, 0, 535, 536, 5, 62, 0, 0, 536, 538, 3, 122, 61, 0, 537, 535, 1, 0, 0, 0, 538, 541, 1, 0, 0, 0, 539, 537, 1, 0, 0, 0, 539, 540, 1, 0, 0, 0, 540, 121, 1, 0, 0, 0, 541, 539, 1, 0, 0, 0, 542, 543, 3, 54, 27, 0, 543, 544, 5, 58, 0, 0, 544, 545, 3, 124, 62, 0, 545, 123, 1, 0, 0, 0, 546, 549, 3, 150, 75, 0, 547, 549, 3, 54, 27, 0, 548, 546, 1, 0, 0, 0, 548, 547, 1, 0, 0, 0, 549, 125, 1, 0, 0, 0, 550, 551, 5, 18, 0, 0, 551, 552, 3, 150, 75, 0, 552, 553, 5, 74, 0, 0, 553, 556, 3, 18, 9, 0, 554, 555, 5, 79, 0, 0, 555, 557, 3, 120, 60, 0, 556, 554, 1, 0, 0, 0, 556, 557, 1, 0, 0, 0, 557, 127, 1, 0, 0, 0, 558, 562, 5, 7, 0, 0, 559, 560, 3, 48, 24, 0, 560, 561, 5, 58, 0, 0, 561, 563, 1, 0, 0, 0, 562, 559, 1, 0, 0, 0, 562, 563, 1, 0, 0, 0, 563, 564, 1, 0, 0, 0, 564, 565, 3, 140, 70, 0, 565, 566, 5, 79, 0, 0, 566, 567, 3, 62, 31, 0, 567, 129, 1, 0, 0, 0, 568, 569, 6, 65, -1, 0, 569, 570, 5, 71, 0, 0, 570, 598, 3, 130, 65, 8, 571, 598, 3, 136, 68, 0, 572, 598, 3, 132, 66, 0, 573, 575, 3, 136, 68, 0, 574, 576, 5, 71, 0, 0, 575, 574, 1, 0, 0, 0, 575, 576, 1, 0, 0, 0, 576, 577, 1, 0, 0, 0, 577, 578, 5, 67, 0, 0, 578, 579, 5, 99, 0, 0, 579, 584, 3, 136, 68, 0, 580, 581, 5, 62, 0, 0, 581, 583, 3, 136, 68, 0, 582, 580, 1, 0, 0, 0, 583, 586, 1, 0, 0, 0, 584, 582, 1, 0, 0, 0, 584, 585, 1, 0, 0, 0, 585, 587, 1, 0, 0, 0, 586, 584, 1, 0, 0, 0, 587, 588, 5, 100, 0, 0, 588, 598, 1, 0, 0, 0, 589, 590, 3, 136, 68, 0, 590, 592, 5, 68, 0, 0, 591, 593, 5, 71, 0, 0, 592, 591, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 594, 1, 0, 0, 0, 594, 595, 5, 72, 0, 0, 595, 598, 1, 0, 0, 0, 596, 598, 3, 134, 67, 0, 597, 568, 1, 0, 0, 0, 597, 571, 1, 0, 0, 0, 597, 572, 1, 0, 0, 0, 597, 573, 1, 0, 0, 0, 597, 589, 1, 0, 0, 0, 597, 596, 1, 0, 0, 0, 598, 607, 1, 0, 0, 0, 599, 600, 10, 5, 0, 0, 600, 601, 5, 56, 0, 0, 601, 606, 3, 130, 65, 6, 602, 603, 10, 4, 0, 0, 603, 604, 5, 75, 0, 0, 604, 606, 3, 130, 65, 5, 605, 599, 1, 0, 0, 0, 605, 602, 1, 0, 0, 0, 606, 609, 1, 0, 0, 0, 607, 605, 1, 0, 0, 0, 607, 608, 1, 0, 0, 0, 608, 131, 1, 0, 0, 0, 609, 607, 1, 0, 0, 0, 610, 612, 3, 136, 68, 0, 611, 613, 5, 71, 0, 0, 612, 611, 1, 0, 0, 0, 612, 613, 1, 0, 0, 0, 613, 614, 1, 0, 0, 0, 614, 615, 5, 70, 0, 0, 615, 616, 3, 160, 80, 0, 616, 641, 1, 0, 0, 0, 617, 619, 3, 136, 68, 0, 618, 620, 5, 71, 0, 0, 619, 618, 1, 0, 0, 0, 619, 620, 1, 0, 0, 0, 620, 621, 1, 0, 0, 0, 621, 622, 5, 77, 0, 0, 622, 623, 3, 160, 80, 0, 623, 641, 1, 0, 0, 0, 624, 626, 3, 136, 68, 0, 625, 627, 5, 71, 0, 0, 626, 625, 1, 0, 0, 0, 626, 627, 1, 0, 0, 0, 627, 628, 1, 0, 0, 0, 628, 629, 5, 70, 0, 0, 629, 630, 5, 99, 0, 0, 630, 635, 3, 160, 80, 0, 631, 632, 5, 62, 0, 0, 632, 634, 3, 160, 80, 0, 633, 631, 1, 0, 0, 0, 634, 637, 1, 0, 0, 0, 635, 633, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 638, 1, 0, 0, 0, 637, 635, 1, 0, 0, 0, 638, 639, 5, 100, 0, 0, 639, 641, 1, 0, 0, 0, 640, 610, 1, 0, 0, 0, 640, 617, 1, 0, 0, 0, 640, 624, 1, 0, 0, 0, 641, 133, 1, 0, 0, 0, 642, 645, 3, 48, 24, 0, 643, 644, 5, 60, 0, 0, 644, 646, 3, 10, 5, 0, 645, 643, 1, 0, 0, 0, 645, 646, 1, 0, 0, 0, 646, 647, 1, 0, 0, 0, 647, 648, 5, 61, 0, 0, 648, 649, 3, 150, 75, 0, 649, 135, 1, 0, 0, 0, 650, 656, 3, 138, 69, 0, 651, 652, 3, 138, 69, 0, 652, 653, 3, 162, 81, 0, 653, 654, 3, 138, 69, 0, 654, 656, 1, 0, 0, 0, 655, 650, 1, 0, 0, 0, 655, 651, 1, 0, 0, 0, 656, 137, 1, 0, 0, 0, 657, 658, 6, 69, -1, 0, 658, 662, 3, 140, 70, 0, 659, 660, 7, 4, 0, 0, 660, 662, 3, 138, 69, 3, 661, 657, 1, 0, 0, 0, 661, 659, 1, 0, 0, 0, 662, 671, 1, 0, 0, 0, 663, 664, 10, 2, 0, 0, 664, 665, 7, 5, 0, 0, 665, 670, 3, 138, 69, 3, 666, 667, 10, 1, 0, 0, 667, 668, 7, 4, 0, 0, 668, 670, 3, 138, 69, 2, 669, 663, 1, 0, 0, 0, 669, 666, 1, 0, 0, 0, 670, 673, 1, 0, 0, 0, 671, 669, 1, 0, 0, 0, 671, 672, 1, 0, 0, 0, 672, 139, 1, 0, 0, 0, 673, 671, 1, 0, 0, 0, 674, 675, 6, 70, -1, 0, 675, 683, 3, 150, 75, 0, 676, 683, 3, 48, 24, 0, 677, 683, 3, 142, 71, 0, 678, 679, 5, 99, 0, 0, 679, 680, 3, 130, 65, 0, 680, 681, 5, 100, 0, 0, 681, 683, 1, 0, 0, 0, 682, 674, 1, 0, 0, 0, 682, 676, 1, 0, 0, 0, 682, 677, 1, 0, 0, 0, 682, 678, 1, 0, 0, 0, 683, 689, 1, 0, 0, 0, 684, 685, 10, 1, 0, 0, 685, 686, 5, 60, 0, 0, 686, 688, 3, 10, 5, 0, 687, 684, 1, 0, 0, 0, 688, 691, 1, 0, 0, 0, 689, 687, 1, 0, 0, 0, 689, 690, 1, 0, 0, 0, 690, 141, 1, 0, 0, 0, 691, 689, 1, 0, 0, 0, 692, 693, 3, 144, 72, 0, 693, 707, 5, 99, 0, 0, 694, 708, 5, 89, 0, 0, 695, 700, 3, 130, 65, 0, 696, 697, 5, 62, 0, 0, 697, 699, 3, 130, 65, 0, 698, 696, 1, 0, 0, 0, 699, 702, 1, 0, 0, 0, 700, 698, 1, 0, 0, 0, 700, 701, 1, 0, 0, 0, 701, 705, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 703, 704, 5, 62, 0, 0, 704, 706, 3, 146, 73, 0, 705, 703, 1, 0, 0, 0, 705, 706, 1, 0, 0, 0, 706, 708, 1, 0, 0, 0, 707, 694, 1, 0, 0, 0, 707, 695, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 5, 100, 0, 0, 710, 143, 1, 0, 0, 0, 711, 712, 3, 62, 31, 0, 712, 145, 1, 0, 0, 0, 713, 714, 5, 92, 0, 0, 714, 719, 3, 148, 74, 0, 715, 716, 5, 62, 0, 0, 716, 718, 3, 148, 74, 0, 717, 715, 1, 0, 0, 0, 718, 721, 1, 0, 0, 0, 719, 717, 1, 0, 0, 0, 719, 720, 1, 0, 0, 0, 720, 722, 1, 0, 0, 0, 721, 719, 1, 0, 0, 0, 722, 723, 5, 93, 0, 0, 723, 147, 1, 0, 0, 0, 724, 725, 3, 160, 80, 0, 725, 726, 5, 61, 0, 0, 726, 727, 3, 150, 75, 0, 727, 149, 1, 0, 0, 0, 728, 771, 5, 72, 0, 0, 729, 730, 3, 158, 79, 0, 730, 731, 5, 101, 0, 0, 731, 771, 1, 0, 0, 0, 732, 771, 3, 156, 78, 0, 733, 771, 3, 158, 79, 0, 734, 771, 3, 152, 76, 0, 735, 771, 3, 58, 29, 0, 736, 771, 3, 160, 80, 0, 737, 738, 5, 97, 0, 0, 738, 743, 3, 154, 77, 0, 739, 740, 5, 62, 0, 0, 740, 742, 3, 154, 77, 0, 741, 739, 1, 0, 0, 0, 742, 745, 1, 0, 0, 0, 743, 741, 1, 0, 0, 0, 743, 744, 1, 0, 0, 0, 744, 746, 1, 0, 0, 0, 745, 743, 1, 0, 0, 0, 746, 747, 5, 98, 0, 0, 747, 771, 1, 0, 0, 0, 748, 749, 5, 97, 0, 0, 749, 754, 3, 152, 76, 0, 750, 751, 5, 62, 0, 0, 751, 753, 3, 152, 76, 0, 752, 750, 1, 0, 0, 0, 753, 756, 1, 0, 0, 0, 754, 752, 1, 0, 0, 0, 754, 755, 1, 0, 0, 0, 755, 757, 1, 0, 0, 0, 756, 754, 1, 0, 0, 0, 757, 758, 5, 98, 0, 0, 758, 771, 1, 0, 0, 0, 759, 760, 5, 97, 0, 0, 760, 765, 3, 160, 80, 0, 761, 762, 5, 62, 0, 0, 762, 764, 3, 160, 80, 0, 763, 761, 1, 0, 0, 0, 764, 767, 1, 0, 0, 0, 765, 763, 1, 0, 0, 0, 765, 766, 1, 0, 0, 0, 766, 768, 1, 0, 0, 0, 767, 765, 1, 0, 0, 0, 768, 769, 5, 98, 0, 0, 769, 771, 1, 0, 0, 0, 770, 728, 1, 0, 0, 0, 770, 729, 1, 0, 0, 0, 770, 732, 1, 0, 0, 0, 770, 733, 1, 0, 0, 0, 770, 734, 1, 0, 0, 0, 770, 735, 1, 0, 0, 0, 770, 736, 1, 0, 0, 0, 770, 737, 1, 0, 0, 0, 770, 748, 1, 0, 0, 0, 770, 759, 1, 0, 0, 0, 771, 151, 1, 0, 0, 0, 772, 773, 7, 6, 0, 0, 773, 153, 1, 0, 0, 0, 774, 777, 3, 156, 78, 0, 775, 777, 3, 158, 79, 0, 776, 774, 1, 0, 0, 0, 776, 775, 1, 0, 0, 0, 777, 155, 1, 0, 0, 0, 778, 780, 7, 4, 0, 0, 779, 778, 1, 0, 0, 0, 779, 780, 1, 0, 0, 0, 780, 781, 1, 0, 0, 0, 781, 782, 5, 55, 0, 0, 782, 157, 1, 0, 0, 0, 783, 785, 7, 4, 0, 0, 784, 783, 1, 0, 0, 0, 784, 785, 1, 0, 0, 0, 785, 786, 1, 0, 0, 0, 786, 787, 5, 54, 0, 0, 787, 159, 1, 0, 0, 0, 788, 789, 5, 53, 0, 0, 789, 161, 1, 0, 0, 0, 790, 791, 7, 7, 0, 0, 791, 163, 1, 0, 0, 0, 792, 793, 7, 8, 0, 0, 793, 794, 5, 114, 0, 0, 794, 795, 3, 166, 83, 0, 795, 796, 3, 168, 84, 0, 796, 165, 1, 0, 0, 0, 797, 798, 3, 28, 14, 0, 798, 167, 1, 0, 0, 0, 799, 800, 5, 74, 0, 0, 800, 805, 3, 170, 85, 0, 801, 802, 5, 62, 0, 0, 802, 804, 3, 170, 85, 0, 803, 801, 1, 0, 0, 0, 804, 807, 1, 0, 0, 0, 805, 803, 1, 0, 0, 0, 805, 806, 1, 0, 0, 0, 806, 169, 1, 0, 0, 0, 807, 805, 1, 0, 0, 0, 808, 809, 3, 136, 68, 0, 809, 171, 1, 0, 0, 0, 72, 183, 193, 222, 237, 243, 252, 258, 271, 275, 286, 302, 310, 314, 321, 327, 334, 342, 350, 358, 362, 366, 371, 382, 387, 391, 405, 416, 422, 436, 457, 465, 468, 473, 489, 495, 502, 513, 527, 539, 548, 556, 562, 575, 584, 592, 597, 605, 607, 612, 619, 626, 635, 640, 645, 655, 661, 669, 671, 682, 689, 700, 705, 707, 719, 743, 754, 765, 770, 776, 779, 784, 805]
+=======
+[4, 1, 139, 806, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 176, 8, 1, 10, 1, 12, 1, 179, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 187, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 218, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 231, 8, 7, 10, 7, 12, 7, 234, 9, 7, 1, 8, 1, 8, 1, 8, 3, 8, 239, 8, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 5, 9, 246, 8, 9, 10, 9, 12, 9, 249, 9, 9, 1, 10, 1, 10, 1, 10, 3, 10, 254, 8, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 5, 13, 265, 8, 13, 10, 13, 12, 13, 268, 9, 13, 1, 13, 3, 13, 271, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 282, 8, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 296, 8, 19, 10, 19, 12, 19, 299, 9, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 3, 21, 306, 8, 21, 1, 21, 1, 21, 3, 21, 310, 8, 21, 1, 22, 1, 22, 1, 22, 5, 22, 315, 8, 22, 10, 22, 12, 22, 318, 9, 22, 1, 23, 1, 23, 1, 23, 3, 23, 323, 8, 23, 1, 24, 1, 24, 1, 24, 5, 24, 328, 8, 24, 10, 24, 12, 24, 331, 9, 24, 1, 25, 1, 25, 1, 25, 5, 25, 336, 8, 25, 10, 25, 12, 25, 339, 9, 25, 1, 26, 1, 26, 1, 26, 5, 26, 344, 8, 26, 10, 26, 12, 26, 347, 9, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 3, 28, 354, 8, 28, 1, 29, 1, 29, 3, 29, 358, 8, 29, 1, 30, 1, 30, 3, 30, 362, 8, 30, 1, 31, 1, 31, 1, 31, 3, 31, 367, 8, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 5, 33, 376, 8, 33, 10, 33, 12, 33, 379, 9, 33, 1, 34, 1, 34, 3, 34, 383, 8, 34, 1, 34, 1, 34, 3, 34, 387, 8, 34, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 399, 8, 37, 10, 37, 12, 37, 402, 9, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 412, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 418, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 5, 42, 430, 8, 42, 10, 42, 12, 42, 433, 9, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 3, 47, 453, 8, 47, 1, 47, 1, 47, 1, 47, 1, 47, 5, 47, 459, 8, 47, 10, 47, 12, 47, 462, 9, 47, 3, 47, 464, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 469, 8, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 3, 50, 482, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 488, 8, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 495, 8, 51, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 54, 4, 54, 504, 8, 54, 11, 54, 12, 54, 505, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 5, 56, 518, 8, 56, 10, 56, 12, 56, 521, 9, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 3, 59, 533, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 539, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 555, 8, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 5, 62, 562, 8, 62, 10, 62, 12, 62, 565, 9, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 572, 8, 62, 1, 62, 1, 62, 1, 62, 3, 62, 577, 8, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 5, 62, 585, 8, 62, 10, 62, 12, 62, 588, 9, 62, 1, 63, 1, 63, 3, 63, 592, 8, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 599, 8, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 606, 8, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 613, 8, 63, 10, 63, 12, 63, 616, 9, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 622, 8, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 629, 8, 63, 10, 63, 12, 63, 632, 9, 63, 1, 63, 1, 63, 3, 63, 636, 8, 63, 1, 64, 1, 64, 1, 64, 3, 64, 641, 8, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 3, 65, 651, 8, 65, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 657, 8, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 5, 66, 665, 8, 66, 10, 66, 12, 66, 668, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 3, 67, 678, 8, 67, 1, 67, 1, 67, 1, 67, 5, 67, 683, 8, 67, 10, 67, 12, 67, 686, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 5, 68, 694, 8, 68, 10, 68, 12, 68, 697, 9, 68, 1, 68, 1, 68, 3, 68, 701, 8, 68, 3, 68, 703, 8, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 5, 70, 713, 8, 70, 10, 70, 12, 70, 716, 9, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 5, 72, 737, 8, 72, 10, 72, 12, 72, 740, 9, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 5, 72, 748, 8, 72, 10, 72, 12, 72, 751, 9, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 5, 72, 759, 8, 72, 10, 72, 12, 72, 762, 9, 72, 1, 72, 1, 72, 3, 72, 766, 8, 72, 1, 73, 1, 73, 1, 74, 1, 74, 3, 74, 772, 8, 74, 1, 75, 3, 75, 775, 8, 75, 1, 75, 1, 75, 1, 76, 3, 76, 780, 8, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 5, 81, 799, 8, 81, 10, 81, 12, 81, 802, 9, 81, 1, 82, 1, 82, 1, 82, 0, 5, 2, 112, 124, 132, 134, 83, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 0, 9, 2, 0, 53, 53, 107, 107, 1, 0, 101, 102, 2, 0, 57, 57, 63, 63, 2, 0, 66, 66, 69, 69, 1, 0, 87, 88, 1, 0, 89, 91, 2, 0, 65, 65, 78, 78, 2, 0, 80, 80, 82, 86, 2, 0, 22, 22, 24, 25, 837, 0, 166, 1, 0, 0, 0, 2, 169, 1, 0, 0, 0, 4, 186, 1, 0, 0, 0, 6, 217, 1, 0, 0, 0, 8, 219, 1, 0, 0, 0, 10, 222, 1, 0, 0, 0, 12, 224, 1, 0, 0, 0, 14, 227, 1, 0, 0, 0, 16, 238, 1, 0, 0, 0, 18, 242, 1, 0, 0, 0, 20, 250, 1, 0, 0, 0, 22, 255, 1, 0, 0, 0, 24, 258, 1, 0, 0, 0, 26, 261, 1, 0, 0, 0, 28, 281, 1, 0, 0, 0, 30, 283, 1, 0, 0, 0, 32, 285, 1, 0, 0, 0, 34, 287, 1, 0, 0, 0, 36, 289, 1, 0, 0, 0, 38, 291, 1, 0, 0, 0, 40, 300, 1, 0, 0, 0, 42, 303, 1, 0, 0, 0, 44, 311, 1, 0, 0, 0, 46, 319, 1, 0, 0, 0, 48, 324, 1, 0, 0, 0, 50, 332, 1, 0, 0, 0, 52, 340, 1, 0, 0, 0, 54, 348, 1, 0, 0, 0, 56, 353, 1, 0, 0, 0, 58, 357, 1, 0, 0, 0, 60, 361, 1, 0, 0, 0, 62, 366, 1, 0, 0, 0, 64, 368, 1, 0, 0, 0, 66, 371, 1, 0, 0, 0, 68, 380, 1, 0, 0, 0, 70, 388, 1, 0, 0, 0, 72, 391, 1, 0, 0, 0, 74, 394, 1, 0, 0, 0, 76, 411, 1, 0, 0, 0, 78, 413, 1, 0, 0, 0, 80, 419, 1, 0, 0, 0, 82, 423, 1, 0, 0, 0, 84, 426, 1, 0, 0, 0, 86, 434, 1, 0, 0, 0, 88, 438, 1, 0, 0, 0, 90, 441, 1, 0, 0, 0, 92, 445, 1, 0, 0, 0, 94, 448, 1, 0, 0, 0, 96, 468, 1, 0, 0, 0, 98, 472, 1, 0, 0, 0, 100, 477, 1, 0, 0, 0, 102, 483, 1, 0, 0, 0, 104, 496, 1, 0, 0, 0, 106, 499, 1, 0, 0, 0, 108, 503, 1, 0, 0, 0, 110, 507, 1, 0, 0, 0, 112, 511, 1, 0, 0, 0, 114, 522, 1, 0, 0, 0, 116, 524, 1, 0, 0, 0, 118, 526, 1, 0, 0, 0, 120, 534, 1, 0, 0, 0, 122, 544, 1, 0, 0, 0, 124, 576, 1, 0, 0, 0, 126, 635, 1, 0, 0, 0, 128, 637, 1, 0, 0, 0, 130, 650, 1, 0, 0, 0, 132, 656, 1, 0, 0, 0, 134, 677, 1, 0, 0, 0, 136, 687, 1, 0, 0, 0, 138, 706, 1, 0, 0, 0, 140, 708, 1, 0, 0, 0, 142, 719, 1, 0, 0, 0, 144, 765, 1, 0, 0, 0, 146, 767, 1, 0, 0, 0, 148, 771, 1, 0, 0, 0, 150, 774, 1, 0, 0, 0, 152, 779, 1, 0, 0, 0, 154, 783, 1, 0, 0, 0, 156, 785, 1, 0, 0, 0, 158, 787, 1, 0, 0, 0, 160, 792, 1, 0, 0, 0, 162, 794, 1, 0, 0, 0, 164, 803, 1, 0, 0, 0, 166, 167, 3, 2, 1, 0, 167, 168, 5, 0, 0, 1, 168, 1, 1, 0, 0, 0, 169, 170, 6, 1, -1, 0, 170, 171, 3, 4, 2, 0, 171, 177, 1, 0, 0, 0, 172, 173, 10, 1, 0, 0, 173, 174, 5, 52, 0, 0, 174, 176, 3, 6, 3, 0, 175, 172, 1, 0, 0, 0, 176, 179, 1, 0, 0, 0, 177, 175, 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 3, 1, 0, 0, 0, 179, 177, 1, 0, 0, 0, 180, 187, 3, 88, 44, 0, 181, 187, 3, 22, 11, 0, 182, 187, 3, 12, 6, 0, 183, 187, 3, 92, 46, 0, 184, 185, 4, 2, 1, 0, 185, 187, 3, 24, 12, 0, 186, 180, 1, 0, 0, 0, 186, 181, 1, 0, 0, 0, 186, 182, 1, 0, 0, 0, 186, 183, 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 187, 5, 1, 0, 0, 0, 188, 218, 3, 40, 20, 0, 189, 218, 3, 8, 4, 0, 190, 218, 3, 70, 35, 0, 191, 218, 3, 64, 32, 0, 192, 218, 3, 42, 21, 0, 193, 218, 3, 66, 33, 0, 194, 218, 3, 72, 36, 0, 195, 218, 3, 74, 37, 0, 196, 218, 3, 78, 39, 0, 197, 218, 3, 80, 40, 0, 198, 218, 3, 94, 47, 0, 199, 218, 3, 82, 41, 0, 200, 218, 3, 158, 79, 0, 201, 218, 3, 102, 51, 0, 202, 218, 3, 120, 60, 0, 203, 204, 4, 3, 2, 0, 204, 218, 3, 100, 50, 0, 205, 206, 4, 3, 3, 0, 206, 218, 3, 98, 49, 0, 207, 208, 4, 3, 4, 0, 208, 218, 3, 104, 52, 0, 209, 210, 4, 3, 5, 0, 210, 218, 3, 106, 53, 0, 211, 212, 4, 3, 6, 0, 212, 218, 3, 118, 59, 0, 213, 214, 4, 3, 7, 0, 214, 218, 3, 116, 58, 0, 215, 216, 4, 3, 8, 0, 216, 218, 3, 122, 61, 0, 217, 188, 1, 0, 0, 0, 217, 189, 1, 0, 0, 0, 217, 190, 1, 0, 0, 0, 217, 191, 1, 0, 0, 0, 217, 192, 1, 0, 0, 0, 217, 193, 1, 0, 0, 0, 217, 194, 1, 0, 0, 0, 217, 195, 1, 0, 0, 0, 217, 196, 1, 0, 0, 0, 217, 197, 1, 0, 0, 0, 217, 198, 1, 0, 0, 0, 217, 199, 1, 0, 0, 0, 217, 200, 1, 0, 0, 0, 217, 201, 1, 0, 0, 0, 217, 202, 1, 0, 0, 0, 217, 203, 1, 0, 0, 0, 217, 205, 1, 0, 0, 0, 217, 207, 1, 0, 0, 0, 217, 209, 1, 0, 0, 0, 217, 211, 1, 0, 0, 0, 217, 213, 1, 0, 0, 0, 217, 215, 1, 0, 0, 0, 218, 7, 1, 0, 0, 0, 219, 220, 5, 15, 0, 0, 220, 221, 3, 124, 62, 0, 221, 9, 1, 0, 0, 0, 222, 223, 3, 54, 27, 0, 223, 11, 1, 0, 0, 0, 224, 225, 5, 12, 0, 0, 225, 226, 3, 14, 7, 0, 226, 13, 1, 0, 0, 0, 227, 232, 3, 16, 8, 0, 228, 229, 5, 62, 0, 0, 229, 231, 3, 16, 8, 0, 230, 228, 1, 0, 0, 0, 231, 234, 1, 0, 0, 0, 232, 230, 1, 0, 0, 0, 232, 233, 1, 0, 0, 0, 233, 15, 1, 0, 0, 0, 234, 232, 1, 0, 0, 0, 235, 236, 3, 48, 24, 0, 236, 237, 5, 58, 0, 0, 237, 239, 1, 0, 0, 0, 238, 235, 1, 0, 0, 0, 238, 239, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, 240, 241, 3, 124, 62, 0, 241, 17, 1, 0, 0, 0, 242, 247, 3, 20, 10, 0, 243, 244, 5, 62, 0, 0, 244, 246, 3, 20, 10, 0, 245, 243, 1, 0, 0, 0, 246, 249, 1, 0, 0, 0, 247, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 19, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 250, 253, 3, 48, 24, 0, 251, 252, 5, 58, 0, 0, 252, 254, 3, 124, 62, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, 21, 1, 0, 0, 0, 255, 256, 5, 19, 0, 0, 256, 257, 3, 26, 13, 0, 257, 23, 1, 0, 0, 0, 258, 259, 5, 20, 0, 0, 259, 260, 3, 26, 13, 0, 260, 25, 1, 0, 0, 0, 261, 266, 3, 28, 14, 0, 262, 263, 5, 62, 0, 0, 263, 265, 3, 28, 14, 0, 264, 262, 1, 0, 0, 0, 265, 268, 1, 0, 0, 0, 266, 264, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 270, 1, 0, 0, 0, 268, 266, 1, 0, 0, 0, 269, 271, 3, 38, 19, 0, 270, 269, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 27, 1, 0, 0, 0, 272, 273, 3, 30, 15, 0, 273, 274, 5, 61, 0, 0, 274, 275, 3, 34, 17, 0, 275, 282, 1, 0, 0, 0, 276, 277, 3, 34, 17, 0, 277, 278, 5, 60, 0, 0, 278, 279, 3, 32, 16, 0, 279, 282, 1, 0, 0, 0, 280, 282, 3, 36, 18, 0, 281, 272, 1, 0, 0, 0, 281, 276, 1, 0, 0, 0, 281, 280, 1, 0, 0, 0, 282, 29, 1, 0, 0, 0, 283, 284, 5, 107, 0, 0, 284, 31, 1, 0, 0, 0, 285, 286, 5, 107, 0, 0, 286, 33, 1, 0, 0, 0, 287, 288, 5, 107, 0, 0, 288, 35, 1, 0, 0, 0, 289, 290, 7, 0, 0, 0, 290, 37, 1, 0, 0, 0, 291, 292, 5, 106, 0, 0, 292, 297, 5, 107, 0, 0, 293, 294, 5, 62, 0, 0, 294, 296, 5, 107, 0, 0, 295, 293, 1, 0, 0, 0, 296, 299, 1, 0, 0, 0, 297, 295, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 39, 1, 0, 0, 0, 299, 297, 1, 0, 0, 0, 300, 301, 5, 9, 0, 0, 301, 302, 3, 14, 7, 0, 302, 41, 1, 0, 0, 0, 303, 305, 5, 14, 0, 0, 304, 306, 3, 44, 22, 0, 305, 304, 1, 0, 0, 0, 305, 306, 1, 0, 0, 0, 306, 309, 1, 0, 0, 0, 307, 308, 5, 59, 0, 0, 308, 310, 3, 14, 7, 0, 309, 307, 1, 0, 0, 0, 309, 310, 1, 0, 0, 0, 310, 43, 1, 0, 0, 0, 311, 316, 3, 46, 23, 0, 312, 313, 5, 62, 0, 0, 313, 315, 3, 46, 23, 0, 314, 312, 1, 0, 0, 0, 315, 318, 1, 0, 0, 0, 316, 314, 1, 0, 0, 0, 316, 317, 1, 0, 0, 0, 317, 45, 1, 0, 0, 0, 318, 316, 1, 0, 0, 0, 319, 322, 3, 16, 8, 0, 320, 321, 5, 15, 0, 0, 321, 323, 3, 124, 62, 0, 322, 320, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 47, 1, 0, 0, 0, 324, 329, 3, 62, 31, 0, 325, 326, 5, 64, 0, 0, 326, 328, 3, 62, 31, 0, 327, 325, 1, 0, 0, 0, 328, 331, 1, 0, 0, 0, 329, 327, 1, 0, 0, 0, 329, 330, 1, 0, 0, 0, 330, 49, 1, 0, 0, 0, 331, 329, 1, 0, 0, 0, 332, 337, 3, 56, 28, 0, 333, 334, 5, 64, 0, 0, 334, 336, 3, 56, 28, 0, 335, 333, 1, 0, 0, 0, 336, 339, 1, 0, 0, 0, 337, 335, 1, 0, 0, 0, 337, 338, 1, 0, 0, 0, 338, 51, 1, 0, 0, 0, 339, 337, 1, 0, 0, 0, 340, 345, 3, 50, 25, 0, 341, 342, 5, 62, 0, 0, 342, 344, 3, 50, 25, 0, 343, 341, 1, 0, 0, 0, 344, 347, 1, 0, 0, 0, 345, 343, 1, 0, 0, 0, 345, 346, 1, 0, 0, 0, 346, 53, 1, 0, 0, 0, 347, 345, 1, 0, 0, 0, 348, 349, 7, 1, 0, 0, 349, 55, 1, 0, 0, 0, 350, 354, 5, 128, 0, 0, 351, 354, 3, 58, 29, 0, 352, 354, 3, 60, 30, 0, 353, 350, 1, 0, 0, 0, 353, 351, 1, 0, 0, 0, 353, 352, 1, 0, 0, 0, 354, 57, 1, 0, 0, 0, 355, 358, 5, 76, 0, 0, 356, 358, 5, 95, 0, 0, 357, 355, 1, 0, 0, 0, 357, 356, 1, 0, 0, 0, 358, 59, 1, 0, 0, 0, 359, 362, 5, 94, 0, 0, 360, 362, 5, 96, 0, 0, 361, 359, 1, 0, 0, 0, 361, 360, 1, 0, 0, 0, 362, 61, 1, 0, 0, 0, 363, 367, 3, 54, 27, 0, 364, 367, 3, 58, 29, 0, 365, 367, 3, 60, 30, 0, 366, 363, 1, 0, 0, 0, 366, 364, 1, 0, 0, 0, 366, 365, 1, 0, 0, 0, 367, 63, 1, 0, 0, 0, 368, 369, 5, 11, 0, 0, 369, 370, 3, 144, 72, 0, 370, 65, 1, 0, 0, 0, 371, 372, 5, 13, 0, 0, 372, 377, 3, 68, 34, 0, 373, 374, 5, 62, 0, 0, 374, 376, 3, 68, 34, 0, 375, 373, 1, 0, 0, 0, 376, 379, 1, 0, 0, 0, 377, 375, 1, 0, 0, 0, 377, 378, 1, 0, 0, 0, 378, 67, 1, 0, 0, 0, 379, 377, 1, 0, 0, 0, 380, 382, 3, 124, 62, 0, 381, 383, 7, 2, 0, 0, 382, 381, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 386, 1, 0, 0, 0, 384, 385, 5, 73, 0, 0, 385, 387, 7, 3, 0, 0, 386, 384, 1, 0, 0, 0, 386, 387, 1, 0, 0, 0, 387, 69, 1, 0, 0, 0, 388, 389, 5, 29, 0, 0, 389, 390, 3, 52, 26, 0, 390, 71, 1, 0, 0, 0, 391, 392, 5, 28, 0, 0, 392, 393, 3, 52, 26, 0, 393, 73, 1, 0, 0, 0, 394, 395, 5, 32, 0, 0, 395, 400, 3, 76, 38, 0, 396, 397, 5, 62, 0, 0, 397, 399, 3, 76, 38, 0, 398, 396, 1, 0, 0, 0, 399, 402, 1, 0, 0, 0, 400, 398, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 75, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 403, 404, 3, 50, 25, 0, 404, 405, 5, 132, 0, 0, 405, 406, 3, 50, 25, 0, 406, 412, 1, 0, 0, 0, 407, 408, 3, 50, 25, 0, 408, 409, 5, 58, 0, 0, 409, 410, 3, 50, 25, 0, 410, 412, 1, 0, 0, 0, 411, 403, 1, 0, 0, 0, 411, 407, 1, 0, 0, 0, 412, 77, 1, 0, 0, 0, 413, 414, 5, 8, 0, 0, 414, 415, 3, 134, 67, 0, 415, 417, 3, 154, 77, 0, 416, 418, 3, 84, 42, 0, 417, 416, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, 79, 1, 0, 0, 0, 419, 420, 5, 10, 0, 0, 420, 421, 3, 134, 67, 0, 421, 422, 3, 154, 77, 0, 422, 81, 1, 0, 0, 0, 423, 424, 5, 27, 0, 0, 424, 425, 3, 48, 24, 0, 425, 83, 1, 0, 0, 0, 426, 431, 3, 86, 43, 0, 427, 428, 5, 62, 0, 0, 428, 430, 3, 86, 43, 0, 429, 427, 1, 0, 0, 0, 430, 433, 1, 0, 0, 0, 431, 429, 1, 0, 0, 0, 431, 432, 1, 0, 0, 0, 432, 85, 1, 0, 0, 0, 433, 431, 1, 0, 0, 0, 434, 435, 3, 54, 27, 0, 435, 436, 5, 58, 0, 0, 436, 437, 3, 144, 72, 0, 437, 87, 1, 0, 0, 0, 438, 439, 5, 6, 0, 0, 439, 440, 3, 90, 45, 0, 440, 89, 1, 0, 0, 0, 441, 442, 5, 97, 0, 0, 442, 443, 3, 2, 1, 0, 443, 444, 5, 98, 0, 0, 444, 91, 1, 0, 0, 0, 445, 446, 5, 33, 0, 0, 446, 447, 5, 136, 0, 0, 447, 93, 1, 0, 0, 0, 448, 449, 5, 5, 0, 0, 449, 452, 5, 38, 0, 0, 450, 451, 5, 74, 0, 0, 451, 453, 3, 50, 25, 0, 452, 450, 1, 0, 0, 0, 452, 453, 1, 0, 0, 0, 453, 463, 1, 0, 0, 0, 454, 455, 5, 79, 0, 0, 455, 460, 3, 96, 48, 0, 456, 457, 5, 62, 0, 0, 457, 459, 3, 96, 48, 0, 458, 456, 1, 0, 0, 0, 459, 462, 1, 0, 0, 0, 460, 458, 1, 0, 0, 0, 460, 461, 1, 0, 0, 0, 461, 464, 1, 0, 0, 0, 462, 460, 1, 0, 0, 0, 463, 454, 1, 0, 0, 0, 463, 464, 1, 0, 0, 0, 464, 95, 1, 0, 0, 0, 465, 466, 3, 50, 25, 0, 466, 467, 5, 58, 0, 0, 467, 469, 1, 0, 0, 0, 468, 465, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 470, 1, 0, 0, 0, 470, 471, 3, 50, 25, 0, 471, 97, 1, 0, 0, 0, 472, 473, 5, 26, 0, 0, 473, 474, 3, 28, 14, 0, 474, 475, 5, 74, 0, 0, 475, 476, 3, 52, 26, 0, 476, 99, 1, 0, 0, 0, 477, 478, 5, 16, 0, 0, 478, 481, 3, 44, 22, 0, 479, 480, 5, 59, 0, 0, 480, 482, 3, 14, 7, 0, 481, 479, 1, 0, 0, 0, 481, 482, 1, 0, 0, 0, 482, 101, 1, 0, 0, 0, 483, 484, 5, 4, 0, 0, 484, 487, 3, 48, 24, 0, 485, 486, 5, 74, 0, 0, 486, 488, 3, 48, 24, 0, 487, 485, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 488, 494, 1, 0, 0, 0, 489, 490, 5, 132, 0, 0, 490, 491, 3, 48, 24, 0, 491, 492, 5, 62, 0, 0, 492, 493, 3, 48, 24, 0, 493, 495, 1, 0, 0, 0, 494, 489, 1, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 103, 1, 0, 0, 0, 496, 497, 5, 30, 0, 0, 497, 498, 3, 52, 26, 0, 498, 105, 1, 0, 0, 0, 499, 500, 5, 21, 0, 0, 500, 501, 3, 108, 54, 0, 501, 107, 1, 0, 0, 0, 502, 504, 3, 110, 55, 0, 503, 502, 1, 0, 0, 0, 504, 505, 1, 0, 0, 0, 505, 503, 1, 0, 0, 0, 505, 506, 1, 0, 0, 0, 506, 109, 1, 0, 0, 0, 507, 508, 5, 99, 0, 0, 508, 509, 3, 112, 56, 0, 509, 510, 5, 100, 0, 0, 510, 111, 1, 0, 0, 0, 511, 512, 6, 56, -1, 0, 512, 513, 3, 114, 57, 0, 513, 519, 1, 0, 0, 0, 514, 515, 10, 1, 0, 0, 515, 516, 5, 52, 0, 0, 516, 518, 3, 114, 57, 0, 517, 514, 1, 0, 0, 0, 518, 521, 1, 0, 0, 0, 519, 517, 1, 0, 0, 0, 519, 520, 1, 0, 0, 0, 520, 113, 1, 0, 0, 0, 521, 519, 1, 0, 0, 0, 522, 523, 3, 6, 3, 0, 523, 115, 1, 0, 0, 0, 524, 525, 5, 31, 0, 0, 525, 117, 1, 0, 0, 0, 526, 527, 5, 17, 0, 0, 527, 528, 3, 144, 72, 0, 528, 529, 5, 74, 0, 0, 529, 532, 3, 18, 9, 0, 530, 531, 5, 79, 0, 0, 531, 533, 3, 62, 31, 0, 532, 530, 1, 0, 0, 0, 532, 533, 1, 0, 0, 0, 533, 119, 1, 0, 0, 0, 534, 538, 5, 7, 0, 0, 535, 536, 3, 48, 24, 0, 536, 537, 5, 58, 0, 0, 537, 539, 1, 0, 0, 0, 538, 535, 1, 0, 0, 0, 538, 539, 1, 0, 0, 0, 539, 540, 1, 0, 0, 0, 540, 541, 3, 134, 67, 0, 541, 542, 5, 79, 0, 0, 542, 543, 3, 62, 31, 0, 543, 121, 1, 0, 0, 0, 544, 545, 5, 18, 0, 0, 545, 546, 3, 144, 72, 0, 546, 123, 1, 0, 0, 0, 547, 548, 6, 62, -1, 0, 548, 549, 5, 71, 0, 0, 549, 577, 3, 124, 62, 8, 550, 577, 3, 130, 65, 0, 551, 577, 3, 126, 63, 0, 552, 554, 3, 130, 65, 0, 553, 555, 5, 71, 0, 0, 554, 553, 1, 0, 0, 0, 554, 555, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, 556, 557, 5, 67, 0, 0, 557, 558, 5, 99, 0, 0, 558, 563, 3, 130, 65, 0, 559, 560, 5, 62, 0, 0, 560, 562, 3, 130, 65, 0, 561, 559, 1, 0, 0, 0, 562, 565, 1, 0, 0, 0, 563, 561, 1, 0, 0, 0, 563, 564, 1, 0, 0, 0, 564, 566, 1, 0, 0, 0, 565, 563, 1, 0, 0, 0, 566, 567, 5, 100, 0, 0, 567, 577, 1, 0, 0, 0, 568, 569, 3, 130, 65, 0, 569, 571, 5, 68, 0, 0, 570, 572, 5, 71, 0, 0, 571, 570, 1, 0, 0, 0, 571, 572, 1, 0, 0, 0, 572, 573, 1, 0, 0, 0, 573, 574, 5, 72, 0, 0, 574, 577, 1, 0, 0, 0, 575, 577, 3, 128, 64, 0, 576, 547, 1, 0, 0, 0, 576, 550, 1, 0, 0, 0, 576, 551, 1, 0, 0, 0, 576, 552, 1, 0, 0, 0, 576, 568, 1, 0, 0, 0, 576, 575, 1, 0, 0, 0, 577, 586, 1, 0, 0, 0, 578, 579, 10, 5, 0, 0, 579, 580, 5, 56, 0, 0, 580, 585, 3, 124, 62, 6, 581, 582, 10, 4, 0, 0, 582, 583, 5, 75, 0, 0, 583, 585, 3, 124, 62, 5, 584, 578, 1, 0, 0, 0, 584, 581, 1, 0, 0, 0, 585, 588, 1, 0, 0, 0, 586, 584, 1, 0, 0, 0, 586, 587, 1, 0, 0, 0, 587, 125, 1, 0, 0, 0, 588, 586, 1, 0, 0, 0, 589, 591, 3, 130, 65, 0, 590, 592, 5, 71, 0, 0, 591, 590, 1, 0, 0, 0, 591, 592, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 594, 5, 70, 0, 0, 594, 595, 3, 154, 77, 0, 595, 636, 1, 0, 0, 0, 596, 598, 3, 130, 65, 0, 597, 599, 5, 71, 0, 0, 598, 597, 1, 0, 0, 0, 598, 599, 1, 0, 0, 0, 599, 600, 1, 0, 0, 0, 600, 601, 5, 77, 0, 0, 601, 602, 3, 154, 77, 0, 602, 636, 1, 0, 0, 0, 603, 605, 3, 130, 65, 0, 604, 606, 5, 71, 0, 0, 605, 604, 1, 0, 0, 0, 605, 606, 1, 0, 0, 0, 606, 607, 1, 0, 0, 0, 607, 608, 5, 70, 0, 0, 608, 609, 5, 99, 0, 0, 609, 614, 3, 154, 77, 0, 610, 611, 5, 62, 0, 0, 611, 613, 3, 154, 77, 0, 612, 610, 1, 0, 0, 0, 613, 616, 1, 0, 0, 0, 614, 612, 1, 0, 0, 0, 614, 615, 1, 0, 0, 0, 615, 617, 1, 0, 0, 0, 616, 614, 1, 0, 0, 0, 617, 618, 5, 100, 0, 0, 618, 636, 1, 0, 0, 0, 619, 621, 3, 130, 65, 0, 620, 622, 5, 71, 0, 0, 621, 620, 1, 0, 0, 0, 621, 622, 1, 0, 0, 0, 622, 623, 1, 0, 0, 0, 623, 624, 5, 77, 0, 0, 624, 625, 5, 99, 0, 0, 625, 630, 3, 154, 77, 0, 626, 627, 5, 62, 0, 0, 627, 629, 3, 154, 77, 0, 628, 626, 1, 0, 0, 0, 629, 632, 1, 0, 0, 0, 630, 628, 1, 0, 0, 0, 630, 631, 1, 0, 0, 0, 631, 633, 1, 0, 0, 0, 632, 630, 1, 0, 0, 0, 633, 634, 5, 100, 0, 0, 634, 636, 1, 0, 0, 0, 635, 589, 1, 0, 0, 0, 635, 596, 1, 0, 0, 0, 635, 603, 1, 0, 0, 0, 635, 619, 1, 0, 0, 0, 636, 127, 1, 0, 0, 0, 637, 640, 3, 48, 24, 0, 638, 639, 5, 60, 0, 0, 639, 641, 3, 10, 5, 0, 640, 638, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 642, 1, 0, 0, 0, 642, 643, 5, 61, 0, 0, 643, 644, 3, 144, 72, 0, 644, 129, 1, 0, 0, 0, 645, 651, 3, 132, 66, 0, 646, 647, 3, 132, 66, 0, 647, 648, 3, 156, 78, 0, 648, 649, 3, 132, 66, 0, 649, 651, 1, 0, 0, 0, 650, 645, 1, 0, 0, 0, 650, 646, 1, 0, 0, 0, 651, 131, 1, 0, 0, 0, 652, 653, 6, 66, -1, 0, 653, 657, 3, 134, 67, 0, 654, 655, 7, 4, 0, 0, 655, 657, 3, 132, 66, 3, 656, 652, 1, 0, 0, 0, 656, 654, 1, 0, 0, 0, 657, 666, 1, 0, 0, 0, 658, 659, 10, 2, 0, 0, 659, 660, 7, 5, 0, 0, 660, 665, 3, 132, 66, 3, 661, 662, 10, 1, 0, 0, 662, 663, 7, 4, 0, 0, 663, 665, 3, 132, 66, 2, 664, 658, 1, 0, 0, 0, 664, 661, 1, 0, 0, 0, 665, 668, 1, 0, 0, 0, 666, 664, 1, 0, 0, 0, 666, 667, 1, 0, 0, 0, 667, 133, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 669, 670, 6, 67, -1, 0, 670, 678, 3, 144, 72, 0, 671, 678, 3, 48, 24, 0, 672, 678, 3, 136, 68, 0, 673, 674, 5, 99, 0, 0, 674, 675, 3, 124, 62, 0, 675, 676, 5, 100, 0, 0, 676, 678, 1, 0, 0, 0, 677, 669, 1, 0, 0, 0, 677, 671, 1, 0, 0, 0, 677, 672, 1, 0, 0, 0, 677, 673, 1, 0, 0, 0, 678, 684, 1, 0, 0, 0, 679, 680, 10, 1, 0, 0, 680, 681, 5, 60, 0, 0, 681, 683, 3, 10, 5, 0, 682, 679, 1, 0, 0, 0, 683, 686, 1, 0, 0, 0, 684, 682, 1, 0, 0, 0, 684, 685, 1, 0, 0, 0, 685, 135, 1, 0, 0, 0, 686, 684, 1, 0, 0, 0, 687, 688, 3, 138, 69, 0, 688, 702, 5, 99, 0, 0, 689, 703, 5, 89, 0, 0, 690, 695, 3, 124, 62, 0, 691, 692, 5, 62, 0, 0, 692, 694, 3, 124, 62, 0, 693, 691, 1, 0, 0, 0, 694, 697, 1, 0, 0, 0, 695, 693, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 700, 1, 0, 0, 0, 697, 695, 1, 0, 0, 0, 698, 699, 5, 62, 0, 0, 699, 701, 3, 140, 70, 0, 700, 698, 1, 0, 0, 0, 700, 701, 1, 0, 0, 0, 701, 703, 1, 0, 0, 0, 702, 689, 1, 0, 0, 0, 702, 690, 1, 0, 0, 0, 702, 703, 1, 0, 0, 0, 703, 704, 1, 0, 0, 0, 704, 705, 5, 100, 0, 0, 705, 137, 1, 0, 0, 0, 706, 707, 3, 62, 31, 0, 707, 139, 1, 0, 0, 0, 708, 709, 5, 92, 0, 0, 709, 714, 3, 142, 71, 0, 710, 711, 5, 62, 0, 0, 711, 713, 3, 142, 71, 0, 712, 710, 1, 0, 0, 0, 713, 716, 1, 0, 0, 0, 714, 712, 1, 0, 0, 0, 714, 715, 1, 0, 0, 0, 715, 717, 1, 0, 0, 0, 716, 714, 1, 0, 0, 0, 717, 718, 5, 93, 0, 0, 718, 141, 1, 0, 0, 0, 719, 720, 3, 154, 77, 0, 720, 721, 5, 61, 0, 0, 721, 722, 3, 144, 72, 0, 722, 143, 1, 0, 0, 0, 723, 766, 5, 72, 0, 0, 724, 725, 3, 152, 76, 0, 725, 726, 5, 101, 0, 0, 726, 766, 1, 0, 0, 0, 727, 766, 3, 150, 75, 0, 728, 766, 3, 152, 76, 0, 729, 766, 3, 146, 73, 0, 730, 766, 3, 58, 29, 0, 731, 766, 3, 154, 77, 0, 732, 733, 5, 97, 0, 0, 733, 738, 3, 148, 74, 0, 734, 735, 5, 62, 0, 0, 735, 737, 3, 148, 74, 0, 736, 734, 1, 0, 0, 0, 737, 740, 1, 0, 0, 0, 738, 736, 1, 0, 0, 0, 738, 739, 1, 0, 0, 0, 739, 741, 1, 0, 0, 0, 740, 738, 1, 0, 0, 0, 741, 742, 5, 98, 0, 0, 742, 766, 1, 0, 0, 0, 743, 744, 5, 97, 0, 0, 744, 749, 3, 146, 73, 0, 745, 746, 5, 62, 0, 0, 746, 748, 3, 146, 73, 0, 747, 745, 1, 0, 0, 0, 748, 751, 1, 0, 0, 0, 749, 747, 1, 0, 0, 0, 749, 750, 1, 0, 0, 0, 750, 752, 1, 0, 0, 0, 751, 749, 1, 0, 0, 0, 752, 753, 5, 98, 0, 0, 753, 766, 1, 0, 0, 0, 754, 755, 5, 97, 0, 0, 755, 760, 3, 154, 77, 0, 756, 757, 5, 62, 0, 0, 757, 759, 3, 154, 77, 0, 758, 756, 1, 0, 0, 0, 759, 762, 1, 0, 0, 0, 760, 758, 1, 0, 0, 0, 760, 761, 1, 0, 0, 0, 761, 763, 1, 0, 0, 0, 762, 760, 1, 0, 0, 0, 763, 764, 5, 98, 0, 0, 764, 766, 1, 0, 0, 0, 765, 723, 1, 0, 0, 0, 765, 724, 1, 0, 0, 0, 765, 727, 1, 0, 0, 0, 765, 728, 1, 0, 0, 0, 765, 729, 1, 0, 0, 0, 765, 730, 1, 0, 0, 0, 765, 731, 1, 0, 0, 0, 765, 732, 1, 0, 0, 0, 765, 743, 1, 0, 0, 0, 765, 754, 1, 0, 0, 0, 766, 145, 1, 0, 0, 0, 767, 768, 7, 6, 0, 0, 768, 147, 1, 0, 0, 0, 769, 772, 3, 150, 75, 0, 770, 772, 3, 152, 76, 0, 771, 769, 1, 0, 0, 0, 771, 770, 1, 0, 0, 0, 772, 149, 1, 0, 0, 0, 773, 775, 7, 4, 0, 0, 774, 773, 1, 0, 0, 0, 774, 775, 1, 0, 0, 0, 775, 776, 1, 0, 0, 0, 776, 777, 5, 55, 0, 0, 777, 151, 1, 0, 0, 0, 778, 780, 7, 4, 0, 0, 779, 778, 1, 0, 0, 0, 779, 780, 1, 0, 0, 0, 780, 781, 1, 0, 0, 0, 781, 782, 5, 54, 0, 0, 782, 153, 1, 0, 0, 0, 783, 784, 5, 53, 0, 0, 784, 155, 1, 0, 0, 0, 785, 786, 7, 7, 0, 0, 786, 157, 1, 0, 0, 0, 787, 788, 7, 8, 0, 0, 788, 789, 5, 114, 0, 0, 789, 790, 3, 160, 80, 0, 790, 791, 3, 162, 81, 0, 791, 159, 1, 0, 0, 0, 792, 793, 3, 28, 14, 0, 793, 161, 1, 0, 0, 0, 794, 795, 5, 74, 0, 0, 795, 800, 3, 164, 82, 0, 796, 797, 5, 62, 0, 0, 797, 799, 3, 164, 82, 0, 798, 796, 1, 0, 0, 0, 799, 802, 1, 0, 0, 0, 800, 798, 1, 0, 0, 0, 800, 801, 1, 0, 0, 0, 801, 163, 1, 0, 0, 0, 802, 800, 1, 0, 0, 0, 803, 804, 3, 130, 65, 0, 804, 165, 1, 0, 0, 0, 72, 177, 186, 217, 232, 238, 247, 253, 266, 270, 281, 297, 305, 309, 316, 322, 329, 337, 345, 353, 357, 361, 366, 377, 382, 386, 400, 411, 417, 431, 452, 460, 463, 468, 481, 487, 494, 505, 519, 532, 538, 554, 563, 571, 576, 584, 586, 591, 598, 605, 614, 621, 630, 635, 640, 650, 656, 664, 666, 677, 684, 695, 700, 702, 714, 738, 749, 760, 765, 771, 774, 779, 800]
+>>>>>>> 855822c8ef9 (Add support for RLIKE (LIST))
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseListener.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseListener.java
index 8a9bc07a99eae..b0e5c3cb18465 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseListener.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseListener.java
@@ -968,6 +968,18 @@ public class EsqlBaseParserBaseListener implements EsqlBaseParserListener {
* The default implementation does nothing.
*/
@Override public void exitLikeListExpression(EsqlBaseParser.LikeListExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx) { }
/**
* {@inheritDoc}
*
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseVisitor.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseVisitor.java
index 6c13edd55907a..a647606757da1 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseVisitor.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseVisitor.java
@@ -573,6 +573,13 @@ public class EsqlBaseParserBaseVisitor extends AbstractParseTreeVisitor im
* {@link #visitChildren} on {@code ctx}.
*/
@Override public T visitLikeListExpression(EsqlBaseParser.LikeListExpressionContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserListener.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserListener.java
index cfab02cb3d826..bcd0673611beb 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserListener.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserListener.java
@@ -845,6 +845,18 @@ public interface EsqlBaseParserListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitLikeListExpression(EsqlBaseParser.LikeListExpressionContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code rlikeListExpression}
+ * labeled alternative in {@link EsqlBaseParser#regexBooleanExpression}.
+ * @param ctx the parse tree
+ */
+ void enterRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code rlikeListExpression}
+ * labeled alternative in {@link EsqlBaseParser#regexBooleanExpression}.
+ * @param ctx the parse tree
+ */
+ void exitRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx);
/**
* Enter a parse tree produced by {@link EsqlBaseParser#matchBooleanExpression}.
* @param ctx the parse tree
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserVisitor.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserVisitor.java
index b27d3f0210cdb..218106ad72d57 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserVisitor.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserVisitor.java
@@ -512,6 +512,13 @@ public interface EsqlBaseParserVisitor extends ParseTreeVisitor {
* @return the visitor result
*/
T visitLikeListExpression(EsqlBaseParser.LikeListExpressionContext ctx);
+ /**
+ * Visit a parse tree produced by the {@code rlikeListExpression}
+ * labeled alternative in {@link EsqlBaseParser#regexBooleanExpression}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx);
/**
* Visit a parse tree produced by {@link EsqlBaseParser#matchBooleanExpression}.
* @param ctx the parse tree
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ExpressionBuilder.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ExpressionBuilder.java
index cec23786f84dc..328399e78c784 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ExpressionBuilder.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ExpressionBuilder.java
@@ -30,6 +30,7 @@
import org.elasticsearch.xpack.esql.core.expression.UnresolvedStar;
import org.elasticsearch.xpack.esql.core.expression.function.Function;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePattern;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePatternList;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardPattern;
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardPatternList;
import org.elasticsearch.xpack.esql.core.tree.Source;
@@ -44,6 +45,7 @@
import org.elasticsearch.xpack.esql.expression.function.aggregate.FilteredExpression;
import org.elasticsearch.xpack.esql.expression.function.fulltext.MatchOperator;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
+import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLikeList;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLike;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLikeList;
import org.elasticsearch.xpack.esql.expression.predicate.logical.And;
@@ -748,7 +750,7 @@ public Expression visitRlikeExpression(EsqlBaseParser.RlikeExpressionContext ctx
RLike rLike = new RLike(source, left, new RLikePattern(BytesRefs.toString(patternLiteral.fold(FoldContext.small()))));
return ctx.NOT() == null ? rLike : new Not(source, rLike);
} catch (InvalidArgumentException e) {
- throw new ParsingException(source, "Invalid pattern for LIKE [{}]: [{}]", patternLiteral, e.getMessage());
+ throw new ParsingException(source, "Invalid pattern for RLIKE [{}]: [{}]", patternLiteral, e.getMessage());
}
}
@@ -781,6 +783,21 @@ public Expression visitLikeListExpression(EsqlBaseParser.LikeListExpressionConte
return ctx.NOT() == null ? e : new Not(source, e);
}
+ @Override
+ public Expression visitRlikeListExpression(EsqlBaseParser.RlikeListExpressionContext ctx) {
+ Source source = source(ctx);
+ Expression left = expression(ctx.valueExpression());
+ List rLikePatterns = ctx.string()
+ .stream()
+ .map(x -> new RLikePattern(visitString(x).fold(FoldContext.small()).toString()))
+ .toList();
+ // for now we will use the old WildcardLike function for one argument case to allow compatibility in mixed version deployments
+ Expression e = rLikePatterns.size() == 1
+ ? new RLike(source, left, rLikePatterns.getFirst())
+ : new RLikeList(source, left, new RLikePatternList(rLikePatterns));
+ return ctx.NOT() == null ? e : new Not(source, e);
+ }
+
@Override
public Order visitOrderExpression(EsqlBaseParser.OrderExpressionContext ctx) {
return new Order(
diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListErrorTests.java
new file mode 100644
index 0000000000000..0e2fa024bda58
--- /dev/null
+++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListErrorTests.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.xpack.esql.expression.function.scalar.string;
+
+import org.elasticsearch.xpack.esql.core.expression.Expression;
+import org.elasticsearch.xpack.esql.core.tree.Source;
+import org.elasticsearch.xpack.esql.core.type.DataType;
+import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase;
+import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
+import org.hamcrest.Matcher;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import static org.hamcrest.Matchers.equalTo;
+
+public class RLikeListErrorTests extends ErrorsForCasesWithoutExamplesTestCase {
+ @Override
+ protected List cases() {
+ return paramsToSuppliers(RLikeListTests.parameters());
+ }
+
+ @Override
+ protected Stream> testCandidates(List cases, Set> valid) {
+ /*
+ * We can't support certain signatures, and it's safe not to test them because
+ * you can't even build them.... The building comes directly from the parser
+ * and can only make certain types.
+ */
+ return super.testCandidates(cases, valid).filter(sig -> sig.get(1) == DataType.KEYWORD)
+ .filter(sig -> sig.size() > 2 && sig.get(2) == DataType.BOOLEAN);
+ }
+
+ @Override
+ protected Expression build(Source source, List args) {
+ return RLikeTests.buildRLike(logger, source, args);
+ }
+
+ @Override
+ protected Matcher expectedTypeErrorMatcher(List> validPerPosition, List signature) {
+ return equalTo(typeErrorMessage(false, validPerPosition, signature, (v, p) -> "string"));
+ }
+}
diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListSerializationTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListSerializationTests.java
new file mode 100644
index 0000000000000..ff2dd31e2c832
--- /dev/null
+++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListSerializationTests.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.xpack.esql.expression.function.scalar.string;
+
+import org.elasticsearch.xpack.esql.core.expression.Expression;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePattern;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePatternList;
+import org.elasticsearch.xpack.esql.core.tree.Source;
+import org.elasticsearch.xpack.esql.expression.AbstractExpressionSerializationTests;
+import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLikeList;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class RLikeListSerializationTests extends AbstractExpressionSerializationTests {
+ @Override
+ protected RLikeList createTestInstance() {
+ Source source = randomSource();
+ Expression child = randomChild();
+ return new RLikeList(source, child, generateRandomPatternList());
+ }
+
+ @Override
+ protected RLikeList mutateInstance(RLikeList instance) throws IOException {
+ Source source = instance.source();
+ Expression child = instance.field();
+ List patterns = new ArrayList<>(instance.pattern().patternList());
+ int childToModify = randomIntBetween(0, patterns.size() - 1);
+ RLikePattern pattern = patterns.get(childToModify);
+ if (randomBoolean()) {
+ child = randomValueOtherThan(child, AbstractExpressionSerializationTests::randomChild);
+ } else {
+ pattern = randomValueOtherThan(pattern, () -> new RLikePattern(randomAlphaOfLength(4)));
+ }
+ patterns.set(childToModify, pattern);
+ return new RLikeList(source, child, new RLikePatternList(patterns));
+ }
+
+ private RLikePatternList generateRandomPatternList() {
+ int numChildren = randomIntBetween(1, 10); // Ensure at least one child
+ List patterns = new ArrayList<>(numChildren);
+ for (int i = 0; i < numChildren; i++) {
+ RLikePattern pattern = new RLikePattern(randomAlphaOfLength(4));
+ patterns.add(pattern);
+ }
+ return new RLikePatternList(patterns);
+ }
+}
diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListTests.java
new file mode 100644
index 0000000000000..d18c81502117d
--- /dev/null
+++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeListTests.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.xpack.esql.expression.function.scalar.string;
+
+import com.carrotsearch.randomizedtesting.annotations.Name;
+import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.util.BytesRef;
+import org.elasticsearch.xpack.esql.core.expression.Expression;
+import org.elasticsearch.xpack.esql.core.expression.FoldContext;
+import org.elasticsearch.xpack.esql.core.expression.Literal;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePattern;
+import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePatternList;
+import org.elasticsearch.xpack.esql.core.tree.Source;
+import org.elasticsearch.xpack.esql.core.type.DataType;
+import org.elasticsearch.xpack.esql.expression.function.AbstractScalarFunctionTestCase;
+import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
+import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
+import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLikeList;
+import org.junit.AfterClass;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+import static org.elasticsearch.xpack.esql.core.util.TestUtils.randomCasing;
+import static org.elasticsearch.xpack.esql.expression.function.DocsV3Support.renderNegatedOperator;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.nullValue;
+import static org.hamcrest.Matchers.startsWith;
+
+public class RLikeListTests extends AbstractScalarFunctionTestCase {
+ public RLikeListTests(@Name("TestCase") Supplier testCaseSupplier) {
+ this.testCase = testCaseSupplier.get();
+ }
+
+ @ParametersFactory
+ public static Iterable