printРабочее место участника


1987. Newspaper

Ограничения: время – 500ms/1000ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

News agency pays money for articles according to some rules. Each character has its own value (some characters may have value equals to zero). Only printable characters have value. Author gets his payment as a sum of all character's values in the article. You have to determine the amount of money that news agency must pay to an author.
The first line contains an integer `K` (`1\ ≤\ K\ ≤\ 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 in the range from 1 to 1000). If character can not be found in the table, then its value is equal to zero. Next lines contain an article itself. Article can contain up to 10000 characters.
Print how much money publisher must pay for an article in format "x.yy$". Where "x" is a number of dollars without leading zeros, and "yy" number of cents with one leading zero if necessary. Examples: "3.32$", "13.07$", "71.30$", "0.09$".

Sample Input

a 3
A 100
. 5
I 13
ACM International Collegiate 
Programming Contest
(abbreviated as ACM-ICPC or
just ICPC) is an annual
multi-tiered competition
among the universities of 
the world.

Sample Output