{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\n\u003cp\u003e樱田即将迎来一场巨大的革命。为了避免这场革命,浅井圭将采取一些行动。革命的主持人也将采取一些行动来保护浅井圭。在这个问题中,每个行动都可以描述为一个正整数。\u003c/p\u003e\n\u003cp\u003e具体而言,浅井圭将从给定序列$$$a$$$中选择一个非空子序列作为实际行动。与此同时,主持人将从给定序列$$$b$$$中选择一个非空子序列作为防御行动。而行动序列$$$p_1, p_2, \\cdots, p_k$$$的影响值,其长度为$$$k$$$,定义如下:$$$$$$\\sum_{i\u003d1}^{k} p_i \\times 1000^{k-i}$$$$$$\u003c/p\u003e\n\u003cp\u003e现在,给定行动序列$$$a$$$和$$$b$$$,浅井圭将从$$$a$$$中选择一个非空子序列$$$A$$$,主持人将从$$$b$$$中选择一个非空子序列$$$B$$$。只有当$$$A$$$的影响值严格大于$$$B$$$时,浅井圭才能打败主持人。\u003c/p\u003e\n\u003cp\u003e你想知道有多少种方案可以让他们选择子序列$$$A$$$和$$$B$$$,以便浅井圭能够打败主持人。如果$$$A_1 \\neq A_2$$$或$$$B_1 \\neq B_2$$$,两个方案$$$(A_1, B_1), (A_2, B_2)$$$被认为是不同的,如果它们的影响值不同,则两个序列$$$p, q$$$被认为是不同的。在一行中以模998244353输出答案的非负整数。\u003c/p\u003e\n"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含两个正整数$$$n,m~(1\\le n,m \\le 5\\,000)$$$,表示$$$a$$$的长度和$$$b$$$的长度。\u003c/p\u003e\n\u003cp\u003e接下来一行包含$$$n$$$个正整数$$$a_i~(1\\le a_i \\le 100)$$$,表示序列$$$a$$$。\u003c/p\u003e\n\u003cp\u003e接下来一行包含$$$m$$$个正整数$$$b_i~(1\\le b_i \\le 100)$$$,表示序列$$$b$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e输出一行,包含一个非负整数,表示模998244353的答案。\u003c/p\u003e"}},{"title":"示例1","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\u003e3 5\n2 1 2\n1 2 2 1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e22\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e浅井圭可以选择6个子序列:(1)、(2)、(1,2)、(2,1)、(2,2)、(2,1,2),它们的影响值分别为1、2、1002、2001、2002、2001002。主持人可以选择11个子序列:(1)、(2)、(1,1)、(1,2)、(2,1)、(2,2)、(1,1,2)、(1,2,1)、(1,2,2)、(2,1,2)、(2,2,2),它们的影响值分别为1、2、1001、1002、2001、2002、1001002、1002001、1002002、2001002、2002002。\u003c/p\u003e\n\u003cp\u003e总共有$$$0+1+3+4+5+9\u003d22$$$种方案,浅井圭可以打败主持人。\u003c/p\u003e"}}]}