1539_B. Love Song_36700
Petya once wrote a sad love song and shared it to Vasya. The song is a string consisting of lowercase English letters. Vasya made up q questions about this song. Each question is about a subsegment of the song starting from the l-th letter to the r-th letter. Vasya considers a substring made up from characters on this segment and repeats each letter in the subsegment k times, where k is the index of the corresponding letter in the alphabet. For example, if the question is about the substring "abbcb", then Vasya repeats letter 'a' once, each of the letters 'b' twice, letter 'c" three times, so that the resulting string is "abbbbcccbb", its length is 10. Vasya is interested about the length of the resulting string.

Help Petya find the length of each string obtained by Vasya.

Input

The first line contains two integers n and q (1≤ n≤ 100 000, 1≤ q ≤ 100 000) — the length of the song and the number of questions. 

The second line contains one string s — the song, consisting of n lowercase letters of English letters.

Vasya's questions are contained in the next q lines. Each line contains two integers l and r (1 ≤ l ≤ r ≤ n) — the bounds of the question.

Output

Print q lines: for each question print the length of the string obtained by Vasya.

Examples

Input


7 3
abacaba
1 3
2 5
1 7


Output


4
7
11


Input


7 4
abbabaa
1 3
5 7
6 6
2 4


Output


5
4
1
5


Input


13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
4 8
2 5
3 9


Output


82
125
9
191
62
63
97

Note

In the first example Vasya is interested in three questions. In the first question Vasya considers the substring "aba", that transforms to "abba", so the answer is equal to 4. In the second question Vasya considers "baca", that transforms to "bbaccca", so the answer is 7. In the third question Vasya considers the string "abacaba",that transforms to "abbacccabba" of length 11.

import java.util.Scanner;
import java.util.*;
public class Main {//前缀和
    public static void main(String[] args) {
        int slength, n;
        Scanner inp = new Scanner(System.in);
        slength = inp.nextInt();
        n = inp.nextInt();
        inp.nextLine();//nextline()
        String song = inp.nextLine();
        char[] arr = song.toCharArray();
        int[] sum = new int[100050];//C++只能用定值
        int[] out = new int[n];
        sum[0] = 0;
        for (int i = 1; i < slength+1; i++) {
            sum[i] = sum[i - 1] + arr[i-1] - 'a' + 1;

        }
        for (int i = 0; i < n; i++) {
            int l = inp.nextInt();
            int r = inp.nextInt();
            out[i] = sum[r] - sum[l - 1];

        }
        for (int i = 0; i < n; i++) {
            System.out.println(out[i]);


        }


    }
}

7 3
abacaba
1 3
2 5
1 7
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
4 8
2 5
3 9
 7 4
abbabaa
1 3
5 7
6 6
2 4
 2 8
ab
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
 7 3
abacaba
2 3
2 5
1 7
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 13
4 8
2 5
3 9
 7 3
abacaba
2 6
2 5
1 7
 13 7
sonokhisumiwo
1 7
2 10
7 7
1 13
4 8
2 5
3 9
 7 3
abacaba
2 6
2 6
1 7
 13 7
sonokhisumiwo
1 2
2 10
7 7
1 13
4 8
2 5
3 9
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
4 8
2 5
1 9
 7 4
abbabaa
1 3
5 7
6 6
3 4
 7 3
abacaba
2 3
4 5
1 7
 7 1
abacaba
2 6
2 5
1 7
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
4 8
2 5
3 9
 7 2
abacaba
2 6
2 6
1 7
 13 7
sonokhisumiwo
1 2
2 10
7 7
1 13
4 9
2 5
3 9
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
4 8
2 5
2 9
 7 4
abbabaa
1 3
5 7
4 6
3 4
 7 3
abacaba
2 3
4 5
2 7
 13 7
sonoshikumiwo
2 5
2 10
7 7
1 13
4 8
2 5
2 9
 7 1
abacaba
2 3
4 5
2 7
 7 3
abacaba
1 3
1 5
1 7
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
3 8
2 5
3 9
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 13
4 8
4 5
3 9
 13 4
sonokhisumiwo
1 7
2 10
7 7
1 13
4 8
2 5
3 9
 13 7
sonokhisumiwo
1 2
4 10
7 7
1 13
4 8
2 5
3 9
 7 3
abacaba
2 3
4 5
1 1
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
2 8
2 5
3 9
 7 4
abbabaa
1 3
5 7
4 6
3 6
 7 3
abacaba
2 3
5 5
2 7
 13 7
sonoshikumiwo
2 5
2 10
7 7
1 13
4 8
2 5
2 12
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
3 12
2 5
3 9
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 13
1 8
4 5
3 9
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
2 8
2 5
6 9
 7 4
abbabaa
2 3
5 7
4 6
3 6
 13 7
sonoshikumiwo
2 5
2 10
7 7
1 13
7 8
2 5
2 12
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
1 12
2 5
3 9
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 13
1 8
4 5
3 6
 13 7
owimusihkonos
1 7
2 10
7 7
2 13
2 8
2 5
6 9
 13 7
sonokhisumiwo
1 5
1 10
7 7
1 13
1 8
4 5
3 6
 13 7
owimusihkooos
1 7
2 10
7 7
2 13
2 8
2 5
6 9
 7 1
aaacaba
2 3
4 3
4 10
 13 7
sonokhisumiwo
1 5
1 10
7 7
1 13
2 8
4 5
3 6
 13 7
owimusihkooos
1 7
2 10
7 7
2 13
2 8
2 4
6 9
 13 7
owimusihkooos
1 7
2 10
7 8
2 13
2 8
2 4
6 9
 7 2
aaacaba
2 3
1 3
4 10
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 8
4 8
2 5
3 9
 7 3
abacaba
3 6
2 5
1 7
 13 7
sonokhisumiwo
1 7
2 10
7 7
1 13
1 8
2 5
3 9
 13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
4 8
2 5
1 1
 7 3
abacaba
1 3
4 5
1 7
 7 2
abacaba
2 6
4 6
1 7
 13 7
sonokhisumiwo
1 2
2 10
7 7
2 13
4 9
2 5
3 9
 7 3
abacaba
2 3
4 7
2 7
 7 2
abacaba
2 6
3 6
2 7
 13 7
owimukihsonos
2 5
2 10
7 7
1 13
4 8
2 5
2 9
 13 7
sonoshikumjwo
1 5
2 10
7 7
1 13
3 8
2 5
3 9
 13 7
sonokhisumiwo
2 5
2 10
7 7
1 13
4 8
4 5
3 9
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
2 8
4 5
3 9
 7 4
abbabaa
1 3
5 7
4 5
3 6
 7 3
abacbaa
2 3
5 5
2 7
 7 2
abacaba
2 6
1 6
2 3
 13 7
sonoshikumiwo
2 5
2 10
7 7
1 13
4 8
2 5
2 11
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
2 8
2 5
6 11
 13 1
sonoshikumiwo
2 5
2 10
7 7
1 13
7 8
2 5
2 12
 7 1
abacaba
2 5
4 5
4 10
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 13
1 8
1 5
3 6
 13 7
owimusihkooos
1 7
2 10
7 7
2 13
2 8
2 9
6 9
 7 1
aaacaba
2 5
4 3
4 10
 13 7
snnokhisumiwo
1 5
1 10
7 7
1 13
2 8
4 5
3 6
 13 7
owimusihkooos
1 7
2 10
7 7
2 13
2 8
2 4
6 12
 7 1
aaacaba
3 3
1 3
4 6
 7 2
baacaba
2 3
1 3
4 10
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 8
4 4
2 5
3 9
 7 3
abacaba
1 6
4 5
1 7
 7 2
abacaba
2 7
4 6
1 7
 13 7
sonokhisuliwo
1 2
2 10
7 7
2 13
4 9
2 5
3 9
 7 2
aaacabb
2 6
3 6
2 7
 13 7
owimukihsonos
2 5
2 10
7 7
1 13
8 8
2 5
2 9
 13 7
sonokhisumiwo
2 2
2 10
7 7
1 13
4 8
4 5
3 9
 13 4
sonokhisumiwo
1 7
2 10
7 7
2 13
4 1
2 5
3 9
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
2 8
4 5
5 9
 13 7
sonokhisumiwo
1 7
2 10
7 7
2 13
2 8
2 2
6 11
 13 7
sonokhisumiwo
1 5
2 10
7 7
1 13
1 8
1 9
3 6
 13 7
soookhisumiwo
1 7
2 10
7 7
2 13
2 8
2 9
6 9
 13 7
snnokhisumiwo
1 5
1 10
4 7
1 13
2 8
4 5
3 6
 7 3
aaacabb
2 6
3 6
2 7
 13 7
owimukihsonos
2 4
2 10
7 7
1 13
8 8
2 5
2 9
 13 4
sonokhisumiwo
1 7
2 10
7 7
3 13
4 1
2 5
3 9
 13 7
sonokhisuwimo
1 7
2 10
7 7
2 13
2 8
4 5
5 9
 13 7
sonokhisumiwo
1 5
2 10
7 10
1 13
1 8
1 9
3 6
 13 7
snnokhisumiwo
1 5
1 10
4 7
1 13
2 8
5 5
3 6
 13 7
owimukihsonos
3 4
2 10
7 7
1 13
8 8
2 5
2 9
 7 1
abacaba
1 3
2 3
1 13
 13 4
sonokhisumiwo
1 7
2 11
7 7
3 13
4 1
2 5
3 9
 13 7
sonokhisuwimo
1 7
2 13
7 7
2 13
2 8
4 5
5 9
 7 2
abacaba
4 6
1 6
5 3
 13 7
knnoshisumiwo
1 5
1 10
4 7
1 13
2 8
5 5
3 6
 7 2
abacaba
3 6
1 6
5 3
 13 1
sonoshikumiwo
3 5
2 11
7 7
1 13
12 8
1 5
2 12
 13 4
knnoshisumiwo
1 5
1 10
4 7
1 13
2 8
5 5
3 6
 13 7
sonoshikumiwo
1 5
3 10
7 7
1 13
4 8
2 5
3 9
 7 4
abbabaa
1 3
3 7
6 6
3 4

4
7
11
 82
125
9
191
62
63
97
 5
4
1
5
 3
3
3
3
3
3
3
3
 3
7
11
 74
125
9
191
62
55
97
 9
7
11
 91
125
9
191
62
55
97
 9
9
11
 34
125
9
191
62
55
97
 82
125
9
191
62
63
131
 5
4
1
3
 3
4
11
 9
 91
125
9
172
62
55
97
 9
9
 34
125
9
191
83
55
97
 82
125
9
191
62
63
112
 5
4
4
3
 3
4
10
 63
125
9
191
62
63
112
 3
 4
8
11
 82
125
9
191
76
63
97
 74
125
9
191
62
26
97
 91
125
9
191
 34
96
9
191
62
55
97
 3
4
1
 91
125
9
172
91
55
97
 5
4
4
6
 3
1
10
 63
125
9
191
62
63
157
 82
125
9
191
142
63
97
 74
125
9
191
110
26
97
 91
125
9
172
91
55
57
 4
4
4
6
 63
125
9
191
20
63
157
 82
125
9
191
176
63
97
 74
125
9
191
110
26
48
 109
128
9
176
102
66
47
 74
144
9
191
110
26
48
 109
128
9
177
102
66
47
 2
 74
144
9
191
91
26
48
 109
128
9
177
102
45
47
 109
128
17
177
102
45
47
 2
3
 74
125
9
110
62
55
97
 7
7
11
 91
125
9
191
110
55
97
 82
125
9
191
62
63
19
 4
4
11
 9
6
 34
125
9
172
83
55
97
 3
7
10
 9
7
 66
128
9
191
62
66
113
 82
125
9
192
76
63
97
 55
125
9
191
62
26
97
 91
125
9
172
91
26
97
 5
4
3
6
 3
2
10
 9
10
 63
125
9
191
62
63
134
 91
125
9
172
91
55
79
 63
 7
 74
125
9
191
110
74
48
 109
128
9
177
102
113
47
 6
 73
143
9
190
90
26
48
 109
128
9
177
102
45
92
 1
 2
4
 74
125
9
110
15
55
97
 10
4
11
 10
6
 34
124
9
171
83
55
97
 8
7
 66
128
9
191
8
66
113
 15
125
9
191
62
26
97
 91
125
9
172
 91
125
9
172
91
26
68
 91
125
9
172
91
15
79
 74
125
9
191
110
131
48
 92
126
9
173
92
113
57
 73
143
43
190
90
26
48
 8
7
10
 45
128
9
191
8
66
113
 91
125
9
157
 91
135
9
172
91
26
68
 74
125
62
191
110
131
48
 73
143
43
190
90
11
48
 22
128
9
191
8
66
113
 4
 91
134
9
157
 91
172
9
172
91
26
68
 6
10
 73
143
51
190
98
19
56
 7
10
 48
 73
143
51
190
 82
110
9
191
62
63
97
 5
7
1
3
