欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1539B.Love Song
Love Song
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 questions about this song. Each question is about a subsegment of the song starting from the -th letter to the -th letter. Vasya considers a substring made up from characters on this segment and repeats each letter in the subsegment times, where 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 . 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 and (, ) — the length of the song and the number of questions.
The second line contains one string — the song, consisting of lowercase letters of English letters.
Vasya's questions are contained in the next lines. Each line contains two integers and () — the bounds of the question.
Output
Print lines: for each question print the length of the string obtained by Vasya.
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 . In the second question Vasya considers "baca", that transforms to "bbaccca", so the answer is . In the third question Vasya considers the string "abacaba",that transforms to "abbacccabba" of length .
Samples
7 3
abacaba
1 3
2 5
1 7
4
7
11
7 4
abbabaa
1 3
5 7
6 6
2 4
5
4
1
5
13 7
sonoshikumiwo
1 5
2 10
7 7
1 13
4 8
2 5
3 9
82
125
9
191
62
63
97
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |