{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"PLAIN","content":"Có N vật được sắp thành hàng ngang.\nBạn phải tô cho mỗi vật một trong ba màu đỏ vàng xanh sao cho toàn bộ M điều kiện thỏa mãn.\nĐiều kiện thứ i là số màu phân biệt từ vật thứ l_i đến vật thứ r_i là x_i.\nHỏi có bao cách tô ? In đáp án ở modulo 10^9 + 7."}},{"title":"Constraints","value":{"format":"PLAIN","content":"1 \u003c\u003d N, M \u003c\u003d 300\n1 \u003c\u003d l_i \u003c\u003d r_i \u003c\u003d N\n1 \u003c\u003d x_i \u003c\u003d 3"}},{"title":"Input","value":{"format":"PLAIN","content":"Dữ liệu đầu vào có dạng như sau:\nN M\nl_1 r_1 x_1\nl_2 r_2 x_2\n...\nl_M r_M x_M"}},{"title":"Output","value":{"format":"PLAIN","content":"In ra đáp án ở modulo 10^9 + 7"}},{"title":"Sample Input 1","value":{"format":"PLAIN","content":"3 1\n1 3 3\n"}},{"title":"Sample Output 1","value":{"format":"PLAIN","content":"6\n"}},{"title":"Sample Input 2","value":{"format":"PLAIN","content":"4 2\n1 3 1\n2 4 2\n"}},{"title":"Sample Output 2","value":{"format":"PLAIN","content":"6\n"}},{"title":"Sample Input 3","value":{"format":"PLAIN","content":"1 3\n1 1 1\n1 1 2\n1 1 3\n"}},{"title":"Sample Output 3","value":{"format":"PLAIN","content":"0\n"}},{"title":"Sample Input 4","value":{"format":"PLAIN","content":"8 10\n2 6 2\n5 5 1\n3 5 2\n4 7 3\n4 4 1\n2 3 1\n7 7 1\n1 5 2\n1 7 3\n3 4 2\n"}},{"title":"Sample Output 4","value":{"format":"PLAIN","content":"108\n"}}]}