#CCBCHBAHAI0000073. Initializer đầy đủ (Full Array Initializer)

Initializer đầy đủ (Full Array Initializer)

Full Array Initializer

Source: Understanding and Using C Pointers

Version: Phuoc Hung OJ Extended

Problem Statement

Five integers x0,x1,x2,x3,x4x_0,x_1,x_2,x_3,x_4 describe a full initializer equivalent to

long long a[5] = {x0, x1, x2, x3, x4};

Every index from 00 through 44 receives the corresponding initializer value. Then qq queries follow; each query gives a valid index pp. Print apa_p.

Input

  • The first line contains five integers x0,x1,x2,x3,x4x_0,x_1,x_2,x_3,x_4.
  • The second line contains qq.
  • The third line contains exactly qq indices p1,p2,…,pqp_1,p_2,\ldots,p_q, each in [0,4][0,4].

Output

For each query, print the array element at the requested index on its own line.

Subtasks

Subtask 1 (20 points): q=1q=1, −9≤xi≤9-9\le x_i\le9.

Subtask 2 (30 points): 1≤q≤51\le q\le5, 0≤xi≤1040\le x_i\le10^4.

Subtask 3 (50 points): 1≤q≤1001\le q\le100, −109≤xi≤109-10^9\le x_i\le10^9.

Examples

Input

1 2 4 8 16
4
0 2 4 1

Output

1
4
16
2

Explanation

The initializer creates a=(1,2,4,8,16)a=(1,2,4,8,16). The queries ask for indices 0,2,4,10,2,4,1, so the answers are a0=1a_0=1, a2=4a_2=4, a4=16a_4=16, and a1=2a_1=2.