시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 6 4 4 80.000%

문제

The substring() function is a commonly-used operation available in most programming languages that operates on strings. A start offset and a length are provided and used to construct a new string containing only the characters in a sequence of that length beginning from the offset.

One particular string has had this called a large number of times in sequence: we repeatedly used the standard library function substring(s, start, length) to chop it up until now a potentially much shorter string remains.

Find the value of the string produced by all of these operations.

입력

  • The first line of input contains the string s (1 ≤ |s| ≤ 106).
  • The second line of input contains the number of operations, n (1 ≤ n ≤ 106).
  • Each of the following n lines contains the two integers starti and lengthi (0 ≤ starti < lengthi−1; 1 ≤ starti + lengthi ≤ lengthi−1).

출력

Output the string after all of the successive substring() operations.

예제 입력 1

helloworld
2
1 9
0 5

예제 출력 1

ellow

예제 입력 2

abcdefghijklmnopqrstuvwxyz
8
1 24
1 22
1 20
1 18
1 16
1 14
1 12
1 10

예제 출력 2

ijklmnopqr