{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e今天是SF的生日,所以VS给了SF两个字符串S1和S2作为礼物,其中包含一个很大的秘密。SF对这个秘密很感兴趣,于是问VS如何获取它。以下是VS告诉他的事情:\u003cbr\u003e\u0026nbsp;\u0026nbsp;后缀(S2,i) \u003d S2[i...len]。Ni是后缀(S2,i)在S1中出现的次数,Li是后缀(S2,i)的长度。那么秘密就是Ni和Li的乘积之和。\u003cbr\u003e\u0026nbsp;\u0026nbsp;现在SF希望你帮他找到这个秘密。答案可能非常大,所以答案应该对1000000007取模。\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"输入包含多个测试用例。\u003cbr\u003e\u0026nbsp;\u0026nbsp;第一行包含一个整数T,表示测试用例的数量。接下来是T个测试用例。\u003cbr\u003e\u0026nbsp;\u0026nbsp;每个测试用例包含两行。第一行包含一个字符串S1。第二行包含一个字符串S2。\u003cbr\u003e\u0026nbsp;\u0026nbsp;1≤T≤10。1≤|S1|,|S2|≤1e6。S1和S2只包含小写和大写字母。"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,输出一个整数,表示测试用例的答案。\u003cbr\u003e\u0026nbsp;\u0026nbsp;答案可能非常大,所以答案应该对1e9+7取模。"}},{"title":"样例","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\naaaaa\r\naa\r\nabababab\r\naba\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e13\r\n19\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"提示","value":{"format":"HTML","content":"\u003cbr\u003e案例2: \u003cbr\u003e后缀(S2,1) \u003d \"aba\",\u003cbr\u003e后缀(S2,2) \u003d \"ba\",\u003cbr\u003e后缀(S2,3) \u003d \"a\".\u003cbr\u003eN1 \u003d 3,\u003cbr\u003eN2 \u003d 3,\u003cbr\u003eN3 \u003d 4.\u003cbr\u003eL1 \u003d 3,\u003cbr\u003eL2 \u003d 2,\u003cbr\u003eL3 \u003d 1.\u003cbr\u003e答案 \u003d (3*3+3*2+4*1)%1000000007。\u003cbr\u003e"}}]}