{"raw_statement":[{"iden":"statement","content":"While I was working in the company, the internet broke. I didn't have anything to do without internet, so I decided to write this ACM problem. \n\nWe need to mix between two strings and also we should keep the same order for both strings. \n\nexample: if we have s1 = \"ab\" and s2 = \"cd\", we can generate six strings: \n\nabcd   acbd \n\nacdb cdab \n\ncadb cabd \n\nbut now I have a problem. I need to calculate the complexity for this problem to make input and output files. \n\nyou will be given the length of two strings and you should help me to find the number of strings that could be generated (if there is a repeated string, count it every time). \n\nYour program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 10000). Followed by the test cases, each test case is on one line. it contains two numbers N and M the length of s1 and s2 where 1 ≤ N, M ≤ 10000\n\nFor each test case, print a single line which contains a single integer that is representing the number of strings that could be generated MOD 10^9+7.\n\n"},{"iden":"input","content":"Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 10000). Followed by the test cases, each test case is on one line. it contains two numbers N and M the length of s1 and s2 where 1 ≤ N, M ≤ 10000"},{"iden":"output","content":"For each test case, print a single line which contains a single integer that is representing the number of strings that could be generated MOD 10^9+7."},{"iden":"examples","content":"Input31 11 22 2Output236"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $ be the number of gift packs.  \nFor each pack $ i \\in \\{1, \\dots, N\\} $, define:  \n- $ x_i \\in [L_i, R_i] \\cap \\mathbb{Z} $,  \n- $ y_i \\in [0, A_i] \\cap \\mathbb{Z} $,  \n- $ z_i \\in [0, B_i] \\cap \\mathbb{Z} $.  \n\n**Objective**  \nFor each pack $ i $, maximize:  \n$$\nf(x_i, y_i, z_i) = (x_i \\oplus y_i) \\& z_i\n$$\n\n**Constraints**  \nFor each $ i \\in \\{1, \\dots, N\\} $:  \n- $ 0 \\le L_i \\le R_i \\le 10^{18} $  \n- $ 0 \\le A_i, B_i \\le 10^{18} $  \n\n**Output**  \nFor each $ i $, output $ \\max_{x_i \\in [L_i,R_i],\\, y_i \\in [0,A_i],\\, z_i \\in [0,B_i]} \\left( (x_i \\oplus y_i) \\& z_i \\right) $.","simple_statement":"You are given N gift packs. Each pack has 3 wine bottles with age constraints:\n\n- First bottle age x: L ≤ x ≤ R  \n- Second bottle age y: 0 ≤ y ≤ A  \n- Third bottle age z: 0 ≤ z ≤ B  \n\nThe deliciousness of a pack is:  \n**(x ^ y) & z**\n\nFor each pack, find the **maximum possible deliciousness** over all valid x, y, z.\n\nPrint the maximum for each of the N packs.","has_page_source":false}