#BS0000055. Thư từ (Letters)

Thư từ (Letters)

Letters

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn dormitories numbered from 11 to nn. Dormitory ii contains aia_i rooms, locally numbered from 11 to aia_i.

If all rooms are concatenated into one sequence, their global numbers range from 11 to

S=a1+a2+⋯+an.S=a_1+a_2+\cdots+a_n.

All rooms of dormitory 11 come first, then all rooms of dormitory 22, and so on.

There are mm letters. Letter jj contains only a global room number bjb_j, where 1≤bj≤S1\le b_j\le S. For every letter, determine the dormitory number and the local room number inside that dormitory.

Input

  • The first line contains integers n,mn,m.
  • The second line contains a1,a2,…,ana_1,a_2,\ldots,a_n.
  • The third line contains b1,b2,…,bmb_1,b_2,\ldots,b_m in increasing order.

Output

Print mm lines. Line jj contains two integers fj,kjf_j,k_j: the dormitory number and local room number corresponding to bjb_j.

Subtasks

  • Subtask 1 — 20%: 1≤n,m≤1001\le n,m\le100, 1≤ai≤1031\le a_i\le10^3.
  • Subtask 2 — 30%: 1≤n,m≤50001\le n,m\le5000, 1≤ai≤1061\le a_i\le10^6.
  • Subtask 3 — 50%: 1≤n,m≤2⋅1051\le n,m\le2\cdot10^5, 1≤ai≤10101\le a_i\le10^{10}; every bjb_j satisfies 1≤bj≤∑i=1nai1\le b_j\le\sum_{i=1}^{n}a_i.

Example

Input

3 6
10 15 12
1 9 12 23 26 37

Output

1 1
1 9
2 2
2 13
3 1
3 12

Explanation

The prefix totals are 10,25,3710,25,37. For example, b3=12b_3=12 belongs to dormitory 22 because 10<12≤2510<12\le25. There are 1010 rooms before that dormitory, so its local room number is 12−10=212-10=2.