You are given a string of length . Let's define a function from a string:
Here |a-b| denotes a distance between characters and in alphabet. In other words, denotes sum of |s_i-s_j| over all 1 \le i \le j \le n. Then, let
Here denotes substring of string from index to . In other words, denotes sum of f(s[l..r]) over all 1 \le l \le r \le n.
You are given queries. Each query changes the element at position to , i.e., s_p = c. You need to print mod before all queries and after each query.
The first line of input contains a single integer (1 \le n \le 2 \cdot 10^5) — the length of the string .
The second line of input contains a string of length .
The third line of input contains a single integer (1 \le q \le 2 \cdot 10^5) — the number of queries.
The following lines contain an integer (1 \le p \le n) and character (c \in \{a,b, \dots, y,z\}) — description of queries.
Print q+1 integers in separate lines — answers for the problem.
Example 1
Example 2
( points): n \le 3;
( points): n,q \le 50;
( points): n,q \le 100;
( points): c,s_i \in \{a,b\};
( points): n,q \le 5000;
( points): n,q \le 20000;
( points): c,s_i \le "n";
( points): n,q \le 10^5;
( points): no additional restrictions.