{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e pre { text-align:left; font-family: \"Courier New\", Courier, monospace; font-size: 16px; white-space: pre; line-height:20px; text-indent: 0px; }\u003c/style\u003e\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eThere is a wonderful country where people like eating very much. Each person has exactly one direct follower while the follower\u0027s follower is also follower of this man (of course the most unattractive man doesn\u0027t have his follower). \u003c/p\u003e\n \u003cp\u003eAnd you find some amazing cake, if you give it to a person, you can have the trust of this person and all his followers. \u003c/p\u003e\n \u003cp\u003eNow you want to give out M cakes randomly to N person (each person can get at most one cake), please calculate the expectation of the trust you have earned. \u003c/p\u003e\n \u003cp\u003eBecause the answer can write as a / b, please output a * b^-1 mod 10^9 + 7. (b * b^-1 ≡ 1 mod 10^9 + 7) \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eFirst line a single integer T indicating the number of cases. T\u0026lt;\u003d1000000; \u003c/p\u003e\n \u003cp\u003eFor each case, first line two number N and M described before. N, M\u0026lt;\u003d1000000; \u003c/p\u003e\n \u003cp\u003e \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eA single integer indicating the expectation of the trust you have earned. (mod 1e9 + 7)\u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\r\n3 3\r\n3 2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e3\r\n666666674\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\n \u003cp\u003eFor case 2, you can give cake to person 1 and 2 or to person 1 and 3 or to person 2 and 3, so answer \u003d 3 * 1 / 3 + 3 * 1 / 3 + 2 * 1 / 3 \u003d 8 / 3 \u003c/p\u003e\n \u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/fbe090c77532ee3ad3924787cc207b7a?v\u003d1620574999\" width\u003d\"100%\" height\u003d\"100%\"\u003e \u003c/p\u003e\n "}}]}