{"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\"\u003eToday is the birthday of SF,so VS gives two strings S1,S2 to SF as a present,which have a big secret.SF is interested in this secret and ask VS how to get it.There are the things that VS tell:\u003cbr\u003e\u0026nbsp;\u0026nbsp;Suffix(S2,i) \u003d S2[i...len].Ni is the times that Suffix(S2,i) occurs in S1 and Li is the length of Suffix(S2,i).Then the secret is the sum of the product of Ni and Li.\u003cbr\u003e\u0026nbsp;\u0026nbsp;Now SF wants you to help him find the secret.The answer may be very large, so the answer should mod 1000000007. \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Input contains multiple cases.\u003cbr\u003e\u0026nbsp;\u0026nbsp;The first line contains an integer T,the number of cases.Then following T cases.\u003cbr\u003e\u0026nbsp;\u0026nbsp;Each test case contains two lines.The first line contains a string S1.The second line contains a string S2.\u003cbr\u003e\u0026nbsp;\u0026nbsp;1\u0026lt;\u003dT\u0026lt;\u003d10.1\u0026lt;\u003d|S1|,|S2|\u0026lt;\u003d1e6.S1 and S2 only consist of lowercase ,uppercase letter."}},{"title":"Output","value":{"format":"HTML","content":"For each test case,output a single line containing a integer,the answer of test case.\u003cbr\u003e\u0026nbsp;\u0026nbsp;The answer may be very large, so the answer should mod 1e9+7. "}},{"title":"Sample","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\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003ecase 2: \u003cbr\u003eSuffix(S2,1) \u003d \"aba\",\u003cbr\u003eSuffix(S2,2) \u003d \"ba\",\u003cbr\u003eSuffix(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\u003eans \u003d (3*3+3*2+4*1)%1000000007.\u003cbr\u003e"}}]}