def read_data_f(filename='arc082-e.dat'):
    try:
        LOCAL_FLAG
        import codecs
        import os

        lines = []
        file_path = os.path.join(os.path.dirname(__file__), filename)
        with codecs.open(file_path, 'r', 'utf-8') as f:
            for each in f:
                lines.append(each.rstrip("\r\n"))

    except NameError:
        lines = []
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
        Q = int(lines[3])
        for i in range(Q):
            lines.append(input())

    return lines
  
def F_Sandglass():
    #
    # 180
    # 3
    # 60 120 180
    # 3
    # 30 90
    # 61 1
    # 180 180
    raw_data = read_data_f('arc082-f.dat')
    X = int(raw_data[0])
    K = int(raw_data[1])
    r = list(map(int, raw_data[2].split()))
    Q = int(raw_data[3])
    a = []
    t = []
    for i in range(Q):
        tt, aa = list(map(int, raw_data[i+4].split()))
        a.append(aa)
        t.append(tt)

    # print(r)
    # print(t)
    # print(a)

    time = 0
    i = j = 0
    U = X
    L = 0
    c = 0
    isUp = True
    time_diff = 0
    r.append(2000000000)
    t.append(1)


    while (i < K+1) and (time < t[Q-1]):
        while((time <= t[j] and t[j] < r[i])):
            time_diff_temp = t[j] - time
            if(isUp):
                c_temp = max(c - time_diff_temp, -X)
                U_temp = U
                L_temp = L
                if(L + c_temp) < 0:
                    L_temp = min(L + time_diff_temp, X)
            else:
                c_temp = min(c + time_diff_temp, X)
                U_temp = U
                if(U + c_temp) > X:
                    U_temp = max(U - time_diff_temp, 0)
                L_temp = L

            if(a[j] > U_temp):
                print(min(U_temp + c_temp, X))
            elif(a[j] < L_temp):
                print(max(L_temp + c_temp, 0))
            else:
                print(a[j] + c_temp)

            j += 1

        time_diff = r[i] - time
        if(isUp):
            c = max(c - time_diff, -X)
            if(L + c) < 0:
                L = -c
                if(L > U):
                    U = L

        else:
            c = min(c + time_diff, X)
            if(U + c) > X:
                U = X - c
                if(L > U):
                    L = U

        time = r[i]
        isUp = not isUp
        i += 1



    # result = remain(X, A[start_time], t[j] - start_time, start_status)
    # print(result)



F_Sandglass()