{"raw_statement":[{"iden":"statement","content":"Alice has a string consisting of characters '_A_', '_B_' and '_C_'. Bob can use the following transitions on any substring of our string in any order any number of times:\n\n*   _A_ _BC_\n*   _B_ _AC_\n*   _C_ _AB_\n*   _AAA_ empty string\n\nNote that a substring is one or more consecutive characters. For given queries, determine whether it is possible to obtain the target string from source."},{"iden":"input","content":"The first line contains a string _S_ (1 ≤ |_S_| ≤ 105). The second line contains a string _T_ (1 ≤ |_T_| ≤ 105), each of these strings consists only of uppercase English letters '_A_', '_B_' and '_C_'.\n\nThe third line contains the number of queries _Q_ (1 ≤ _Q_ ≤ 105).\n\nThe following _Q_ lines describe queries. The _i_\\-th of these lines contains four space separated integers _a__i_, _b__i_, _c__i_, _d__i_. These represent the _i_\\-th query: is it possible to create _T_\\[_c__i_.._d__i_\\] from _S_\\[_a__i_.._b__i_\\] by applying the above transitions finite amount of times?\n\nHere, _U_\\[_x_.._y_\\] is a substring of _U_ that begins at index _x_ (indexed from 1) and ends at index _y_. In particular, _U_\\[1..|_U_|\\] is the whole string _U_.\n\nIt is guaranteed that 1 ≤ _a_ ≤ _b_ ≤ |_S_| and 1 ≤ _c_ ≤ _d_ ≤ |_T_|."},{"iden":"output","content":"Print a string of _Q_ characters, where the _i_\\-th character is '_1_' if the answer to the _i_\\-th query is positive, and '_0_' otherwise."},{"iden":"example","content":"Input\n\nAABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3\n\nOutput\n\n10011"},{"iden":"note","content":"In the first query we can achieve the result, for instance, by using transitions .\n\nThe third query asks for changing _AAB_ to _A_ — but in this case we are not able to get rid of the character '_B_'."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}