{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u003ca href\u003d\"http://uva.onlinejudge.org/external/15/1586.pdf\"\u003e\u003cimg alt\u003d\"Download as PDF\" height\u003d\"26\" src\u003d\"http://uva.onlinejudge.org/components/com_onlinejudge/images/button_pdf.png\" title\u003d\"Download as PDF\" width\u003d\"100\" /\u003e\u003c/a\u003e\u003c/p\u003e \n\u003cdiv\u003e\n \u0026nbsp;\n\u003c/div\u003e \n\u003cp\u003e Hello everyone ,welcome to our programming match. This is your\u0026nbsp;first task!!An organic compound is any member of a large class of chemical compounds whose molecules contain carbon. The molar mass of an organic compound is the mass of one mole of the organic compound. The molar mass of an organic compound can be computed from the standard atomic weights of the elements.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cdiv\u003e \n \u003cimg align\u003d\"right\" alt\u003d\"\\epsfbox{p3900.eps}\" height\u003d\"350\" src\u003d\"http://uva.onlinejudge.org/external/15/p3900.png\" width\u003d\"393\" /\u003e\n\u003c/div\u003e \n\u003cp\u003e When an organic compound is given as a molecular formula, Dr. CHON wants to find its molar mass. A molecular formula, such as C\u003csub\u003e3\u003c/sub\u003eH\u003csub\u003e4\u003c/sub\u003eO\u003csub\u003e3\u003c/sub\u003e , identifies each constituent element by its chemical symbol and indicates the number of atoms of each element found in each discrete molecule of that compound. If a molecule contains more than one atom of a particular element, this quantity is indicated using a subscript after the chemical symbol.\u003c/p\u003e \n\u003cp\u003e In this problem, we assume that the molecular formula is represented by only four elements, `C\u0027 (Carbon), `H\u0027 (Hydrogen), `O\u0027 (Oxygen), and `N\u0027 (Nitrogen) without parentheses.\u003c/p\u003e \n\u003cp\u003e The following table shows that the standard atomic weights for `C\u0027, `H\u0027, `O\u0027, and `N\u0027.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cdiv\u003e \n \u003ctable\u003e \n \u003ccolgroup\u003e \n \u003ccol /\u003e \n \u003c/colgroup\u003e \n \u003ccolgroup\u003e \n \u003ccol /\u003e \n \u003c/colgroup\u003e \n \u003ccolgroup\u003e \n \u003ccol /\u003e \n \u003c/colgroup\u003e \n \u003ccolgroup\u003e \n \u003ccol /\u003e \n \u003c/colgroup\u003e \n \u003ccolgroup\u003e \n \u003ccol /\u003e \n \u003c/colgroup\u003e \n \u003ctbody\u003e \n \u003ctr\u003e \n \u003ctd\u003e Atomic Name\u003c/td\u003e \n \u003ctd\u003e Carbon\u003c/td\u003e \n \u003ctd\u003e Hydrogen\u003c/td\u003e \n \u003ctd\u003e Oxygen\u003c/td\u003e \n \u003ctd\u003e Nitrogen\u003c/td\u003e \n \u003c/tr\u003e \n \u003c/tbody\u003e \n \u003ctbody\u003e \n \u003ctr\u003e \n \u003ctd\u003e Standard Atomic Weight\u003c/td\u003e \n \u003ctd\u003e 12.01 g/mol\u003c/td\u003e \n \u003ctd\u003e 1.008 g/mol\u003c/td\u003e \n \u003ctd\u003e 16.00 g/mol\u003c/td\u003e \n \u003ctd\u003e 14.01 g/mol\u003c/td\u003e \n \u003c/tr\u003e \n \u003c/tbody\u003e \n \u003c/table\u003e \n\u003c/div\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cp\u003e \u003cbr /\u003e For example, the molar mass of a molecular formula C\u003csub\u003e6\u003c/sub\u003eH\u003csub\u003e5\u003c/sub\u003eOH is 94.108 g/mol which is computed by 6 \u0026times; (12.01 g/mol) + 6 \u0026times; (1.008 g/mol) + 1 \u0026times; (16.00 g/mol).\u003c/p\u003e \n\u003cp\u003e Given a molecular formula, write a program to compute the molar mass of the formula.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003e Input\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e Your program is to read from standard input. The input consists of \u003ci\u003eT\u003c/i\u003e test cases. The number of test cases \u003ci\u003eT\u003c/i\u003e is given in the first line of the input. Each test case is given in a single line, which contains a molecular formula as a string. The chemical symbol is given by a capital letter and the length of the string is greater than 0 and less than 80. The quantity number \u003ci\u003en\u003c/i\u003e which is represented after the chemical symbol would be omitted when the number is 1 (2\u003cimg align\u003d\"MIDDLE\" alt\u003d\"$ \\le$\" height\u003d\"31\" src\u003d\"http://uva.onlinejudge.org/external/15/3900img2.png\" width\u003d\"18\" /\u003e\u003ci\u003en\u003c/i\u003e\u003cimg align\u003d\"MIDDLE\" alt\u003d\"$ \\le$\" height\u003d\"31\" src\u003d\"http://uva.onlinejudge.org/external/15/3900img2.png\" width\u003d\"18\" /\u003e99) .\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003e Output\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e Your program is to write to standard output. Print exactly one line for each test case. The line should contain the molar mass of the given molecular formula.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003e Sample Input\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cpre\u003e\r\n4 \r\nC \r\nC6H5OH \r\nNH2CH2COOH \r\nC12H22O11\r\n\u003c/pre\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003e Sample Output\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cpre\u003e\r\n12.010 \r\n94.108 \r\n75.070 \r\n342.296\r\n\u003c/pre\u003e"}}]}