{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"yass_top_edge_dummy\" style\u003d\"width: 1px; height: 1px; padding: 0px; margin: -9px 0px 0px; border-width: 0px; display: block;\"\u003e\r\n\t\u0026nbsp;\u003c/div\u003e\r\n\u003cdiv id\u003d\"yass_top_edge\" style\u003d\"background-image: url(\u0026quot;chrome://yass/content/edgebgtop.png\u0026quot;); background-attachment: scroll; background-position: center bottom; padding: 0px; margin: 0px 0px 8px -8px; border-width: 0px; height: 0px; display: block; width: 1px;\"\u003e\r\n\t\u0026nbsp;\u003c/div\u003e\r\n\u003cstyle type\u003d\"text/css\"\u003e\r\n\u003c/style\u003e\r\n\u003cp\u003e\r\n\tNews agency pays money for articles according to some rules. Each character has its own value (some characters may have value equals to zero). Author gets his payment as a sum of all character\u0026#39;s values in the article. You have to determine the amount of money that news agency must pay to an author.\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003ch4\u003e\r\n\tINPUT:\u003c/h4\u003e\r\n\u003cp\u003e\r\n\tThe first line contains integer N (0 \u0026lt; N \u0026lt;\u003d 5), it is a number of tests. Each test describes an integer K (0 \u0026lt; K \u0026lt;\u003d 100), the number of paid characters. On next K lines there are table of paid characters and its values (character values are written in cents). If character can not be found in the table, then its value is equal to zero. Next, there is integer M (0 \u0026lt; M \u0026lt;\u003d 150000). Next M lines contain an article itself. Each line can be up to 10000 characters length. Be aware of a large input size, the whole input file is about \u003cspan data-scayt_word\u003d\"7MB\" data-scaytid\u003d\"1\"\u003e7MB\u003c/span\u003e.\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003ch4\u003e\r\n\tOUTPUT:\u003c/h4\u003e\r\n\u003cp\u003e\r\n\tFor each test print how much money publisher must pay for an article in format \u0026quot;\u003ccode\u003ex.yy$\u003c/code\u003e\u0026quot;. Where \u0026quot;\u003ccode\u003ex\u003c/code\u003e\u0026quot; is a number of dollars without leading zeros, and \u0026quot;\u003ccode\u003e\u003cspan data-scayt_word\u003d\"yy\" data-scaytid\u003d\"3\"\u003eyy\u003c/span\u003e\u003c/code\u003e\u0026quot; number of cents with one leading zero if necessary. Examples: \u0026quot;\u003ccode\u003e3.32$\u003c/code\u003e\u0026quot;, \u0026quot;\u003ccode\u003e13.07$\u003c/code\u003e\u0026quot;, \u0026quot;\u003ccode\u003e71.30$\u003c/code\u003e\u0026quot;, \u0026quot;\u003ccode\u003e0.09$\u003c/code\u003e\u0026quot;.\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003ch4\u003e\r\n\tSAMPLE INPUT:\u003c/h4\u003e\r\n\u003cpre\u003e\r\n\u003ccode\u003e1\r\n7\r\na 3\r\nW 10\r\nA 100\r\n, 10\r\nk 7\r\n. 3\r\nI 13\r\n7\r\nACM International Collegiate Programming Contest (abbreviated\r\nas \u003cspan data-scayt_word\u003d\"ACM-ICPC\" data-scaytid\u003d\"7\"\u003eACM-ICPC\u003c/span\u003e or just \u003cspan data-scayt_word\u003d\"ICPC\" data-scaytid\u003d\"8\"\u003eICPC\u003c/span\u003e) is an annual multi-tiered competition\r\namong the universities of the world. The \u003cspan data-scayt_word\u003d\"ICPC\" data-scaytid\u003d\"9\"\u003eICPC\u003c/span\u003e challenges students\r\nto set ever higher standards of excellence for themselves\r\nthrough competition that rewards team work, problem analysis,\r\nand rapid software development.\r\nFrom Wikipedia.\r\n\u003c/code\u003e\u003c/pre\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003ch4\u003e\r\n\tSAMPLE OUTPUT:\u003c/h4\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cpre\u003e\r\n\u003ccode\u003e3.74$\r\n\u003c/code\u003e\u003c/pre\u003e\r\n\u003chr /\u003e"}}]}