Okabe likes writing notes for himself. Since he writes about strange things and does not want others to think he is weird, he encodes all his messages in his own super-secret format. Unfortunately for Okabe, you — being an amazing cryptanalyst — have figured out his scheme.
First, he maps a character to an integer
You've gotten your hands on some of Okabe's notes, and would like to decrypt some
Reminder
The notation for representing a number
Input Specification
The first line of input will contain the integers
The next and final line of input will contain
Output Specification
A single integer,
Sample Input 1
5 3
10 10 10
Sample Output 1
5
Sample Input 2
5000 4
7 1001 10 2
Sample Output 2
1715
Explanation
Working your way up from
Step-by-step,
Comments