프로그램 명: coci_redoks
제한시간: 1 초

[문제 요약] 3 번째 입출력 예로 설명 하면

7 5 ... 7 개의 수 시행횟수 5 
9081337  ... 초기 배치 
1 3 
3 7 
1 3 
3 7 
1 3 
7 개의 수의 초기 나열이 9 0 8 1 3 3 7 인 경우
Luka is not paying attention in class again, while the teacher is explaining redox reactions. Instead of paying attention, he is playing with analog dials.

An analog dial is a small device which always shows one digit between 0 and 9. It also contains a small button which increases the number by 1 (unless it is 9, in which case it is changed to 0). Luka has N such dials on his desk, numbered 1 to N left to right, and two sheets of paper for him to write on.

Luka's game starts with him setting the dials in some starting configuration, which he then writes onto the first sheet. Luka then does the following M times:

Just as he had finished his game, the teacher noticed him, and took away all his dials and the second sheet of paper.

Given the contents of the first sheet, help him calculate the numbers on the second sheet.

입력

출력

Output M lines, the sums calculated by Luka, in order in which he calculated them.

입출력 예

input 

4 3 
1234 
1 4 
1 4 
1 4 

output 

10 
14 
18 

input 

4 4 
1234 
1 1 
1 2 
1 3 
1 4 

output 

1 
4 
9 
16

input 

7 5 
9081337 
1 3 
3 7 
1 3 
3 7 
1 3 

output 

17 
23 
1 
19 
5 
출처:coci 2007-2008 contest3 6/6
spoiler
[질/답] [제출 현황] [푼 후(2)]
[ 채 점 ] [홈으로]  [뒤 로]