{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eA checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting transmission errors, validating document contents, and in many other situations where it is necessary to detect undesirable changes in data.\u003c/p\u003e\u003cp\u003eFor this problem, you will implement a checksum algorithm called Quicksum. A Quicksum packet allows only uppercase letters and spaces. It always begins and ends with an uppercase letter. Otherwise, spaces and letters can occur in any combination, including consecutive spaces.\u003c/p\u003e\u003cp\u003eA Quicksum is the sum of the products of each character\u0027s position in the packet times the character\u0027s value. A space has a value of zero, while letters have a value equal to their position in the alphabet. So, A\u003d1, B\u003d2, etc., through Z\u003d26. Here are example Quicksum calculations for the packets \"\u003ccode\u003eACM\u003c/code\u003e\" and \"\u003ccode\u003eMID CENTRAL\u003c/code\u003e\":\u003c/p\u003e\u003cpre\u003e ACM: 1*1 + 2*3 + 3*13 \u003d 46\u003cbr\u003e\u003cbr\u003eMID CENTRAL: 1*13 + 2*9 + 3*4 + 4*0 + 5*3 + 6*5 + 7*14 + 8*20 + 9*18 + 10*1 + 11*12 \u003d 650\u003c/pre\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of one or more packets followed by a line containing only # that signals the end of the input. Each packet is on a line by itself, does not begin or end with a space, and contains from 1 to 255 characters.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each packet, output its Quicksum on a separate line in the output.\u003c/p\u003e"}},{"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\u003eACM\r\nMID CENTRAL\r\nREGIONAL PROGRAMMING CONTEST\r\nACN\r\nA C M\r\nABC\r\nBBC\r\n#\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e46\r\n650\r\n4690\r\n49\r\n75\r\n14\r\n15\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}