Yesterday Chef had a great party and doesn't remember the way he celebreated it. But he found a strange paper in his kitchen containing n digits (lets give them indices from 1 to n and name them a1, a2 ... aN). 
 Chef remembers that he played such game:

 On each step he choose an index x from 1 to n.
 For all indices y (y < x) he calculated the difference by = ax - ay. 
 Then he calculated B1 - sum of all by which are greater than 0 and B2 - sum of all by which are less than 0. 
 The answer for this step is B1 - B2. 

Chef remembers the game, but forgot the answer. Please, help him!

Input

The first line contains two integers n, m denoting the number of digits and number of steps. The second line contains n digits (without spaces) a1, a2, ..., an. 
 Each of next m lines contains single integer x denoting the index for current step. 

 

Output

For each of m steps print single number in a line - answer of the step.

 

Constraints

1 ≤ n, m ≤ 10^5
0 ≤ ai ≤ 9
1 ≤ x ≤ n

 

Example
Input:
10 3
0324152397
1
4
7

Output:
0
7
9


 

Explanation
For index 1 there are no indexes which are less, so B1 = B2 = 0 and the answer is 0.
For index 4 we have 

b1 = 4-0=4, 
b2 = 4-3=1, 
b3 = 4-2=2, 

so B1 = 4+1+2 = 7, B2 = 0 
and the answer is 7.
For index 7 we have

b1 = 2-0=2, 
b2 = 2-3=-1, 
b3 = 2-2=0, 
b4 = 2-4=-2, 
b5 = 2-1=1, 
b6 = 2-5=-3, 

so B1 = 2 + 1 = 3,
     B2 = -1 -2 -3 = -6 
and the answer is 9.
o = raw_input()
ls =[int(j) for j in o.split()]
k = raw_input()
noof1 = 0
noof0 = 0
noof2 = 0
noof3 = 0
noof4 = 0
noof5 = 0
noof6 = 0
noof7 = 0
noof8 = 0
noof9 = 0
ps = []
co = 0
while(co < ls[0]):
    if (k[co]) == "0":
        ps.append(1*noof1+2*noof2+3*noof3+4*noof4+5*noof5+6*noof6+7*noof7+8*noof8+9*noof9)
        
        noof0+=1
    if (k[co]) == "1":
        ps.append(2*noof2+3*noof3+4*noof4+5*noof5+6*noof6+7*noof7+8*noof8+9*noof9-(noof2+noof3+noof4+noof5+noof6+noof7+noof8+noof9-noof0)*1)
        noof1+=1
    if (k[co]) == "2":
        ps.append(-1*noof1+3*noof3+4*noof4+5*noof5+6*noof6+7*noof7+8*noof8+9*noof9-(-noof1+noof3+noof4+noof5+noof6+noof7+noof8+noof9-noof0)*2)
        noof2+=1
    if (k[co]) == "3":
        ps.append(-2*noof2-1*noof1+4*noof4+5*noof5+6*noof6+7*noof7+8*noof8+9*noof9-(-noof2-noof1+noof4+noof5+noof6+noof7+noof8+noof9-noof0)*3)
        noof3+=1
    if (k[co]) == "4":
        ps.append(-2*noof2-3*noof3-1*noof1+5*noof5+6*noof6+7*noof7+8*noof8+9*noof9-(-noof2-noof3-noof1+noof5+noof6+noof7+noof8+noof9-noof0)*4)
        noof4+=1
    if (k[co]) == "5":
        ps.append(-2*noof2-3*noof3-4*noof4-1*noof1+6*noof6+7*noof7+8*noof8+9*noof9-(-noof2-noof3-noof4-noof1+noof6+noof7+noof8+noof9-noof0)*5)
        noof5+=1
    if (k[co]) == "6":
        ps.append(-2*noof2-3*noof3-4*noof4-1*noof1-5*noof5+7*noof7+8*noof8+9*noof9-(-noof2-noof3-noof4-noof1-noof5+noof7+noof8+noof9-noof0)*6)
        noof6+=1
    if (k[co]) == "7":
        ps.append(-2*noof2-3*noof3-4*noof4-1*noof1-5*noof5-6*noof6+8*noof8+9*noof9-(-noof2-noof3-noof4-noof1-noof5-noof6+noof8+noof9-noof0)*7)
        noof7+=1
    if (k[co]) == "8":
        ps.append(-2*noof2-3*noof3-4*noof4-1*noof1-5*noof5-6*noof6-7*noof7+9*noof9-(-noof2-noof3-noof4-noof1-noof5-noof7-noof6+noof9-noof0)*8)
        noof8+=1
    if (k[co]) == "9":
        ps.append(-2*noof2-3*noof3-4*noof4-1*noof1-5*noof5-6*noof6-7*noof7-8*noof8-(-noof2-noof3-noof4-noof1-noof5-noof7-noof6-noof8-noof0)*9)
        noof9+=1
    co=co+1
while(ls[1] > 0):
    ls[1] = ls[1]-1
    j = int(raw_input())
    print ps[j-1]