Professor GukiZ has two arrays of integers, a and b. Professor wants to make the sum of the elements in the array a sa as close as possible to the sum of the elements in the array b sb. So he wants to minimize the value v = |sa - sb|.

In one operation professor can swap some element from the array a and some element from the array b. For example if the array a is [5, 1, 3, 2, 4] and the array b is [3, 3, 2] professor can swap the element 5 from the array a and the element 2 from the array b and get the new array a [2, 1, 3, 2, 4] and the new array b [3, 3, 5].

Professor doesn't want to make more than two swaps. Find the minimal value v and some sequence of no more than two swaps that will lead to the such value v. Professor makes swaps one by one, each new swap he makes with the new arrays a and b.

Input

The first line contains integer n (1 ≤ n ≤ 2000) — the number of elements in the array a.

The second line contains n integers ai ( - 109 ≤ ai ≤ 109) — the elements of the array a.

The third line contains integer m (1 ≤ m ≤ 2000) — the number of elements in the array b.

The fourth line contains m integers bj ( - 109 ≤ bj ≤ 109) — the elements of the array b.

Output

In the first line print the minimal value v = |sa - sb| that can be got with no more than two swaps.

The second line should contain the number of swaps k (0 ≤ k ≤ 2).

Each of the next k lines should contain two integers xp, yp (1 ≤ xp ≤ n, 1 ≤ yp ≤ m) — the index of the element in the array a and the index of the element in the array b in the p-th swap.

If there are several optimal solutions print any of them. Print the swaps in order the professor did them.

Examples

Input

5
5 4 3 2 1
4
1 1 1 1


Output

1
2
1 1
4 2


Input

5
1 2 3 4 5
1
15


Output

0
0


Input

5
1 2 3 4 5
4
1 2 3 4


Output

1
1
3 1
import java.util.stream.*;
import java.util.*;

public class Task620D {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Tuple[] a = new Tuple[s.nextInt()];
        for(int i = 0; i < a.length; i++) {
            a[i] = new Tuple(2 * s.nextInt(), i);
        }
        Tuple[] b = new Tuple[s.nextInt()];
        for(int i = 0; i < b.length; i++) {
            b[i] = new Tuple(2 * s.nextInt(), i);
        }
        long sa = Arrays.asList(a).stream().mapToLong(o -> o.v).sum() / 2;
        long sb = Arrays.asList(b).stream().mapToLong(o -> o.v).sum() / 2;
        long mins = sa - sb;
        Res res1 = optimize(mins, a, b);
        Res res2 = optimize(mins, genPerm(a), genPerm(b));
        printRes(res1, res2);
    }
    private static Tuple[] genPerm(Tuple[] in) {
        List<Tuple> res = new ArrayList<>();
        for(int i = 0; i < in.length - 1; i++) {
            for(int j = i + 1; j < in.length; j++) {
                res.add(new Tuple(in[i].v + in[j].v, in[i].idx, in[j].idx));
            }
        }
        return res.toArray(new Tuple[0]);
    }

    private static void printRes(Res res1, Res res2) {
        int num = 0;
        if(res1.a != null)
            num = 1;
        if(res2.a != null && res2.s < res1.s)
            num = 2;
        System.out.println(num < 2 ? res1.s : res2.s);
        System.out.println(num);
        if(num == 1) {
            System.out.println((res1.a.idx + 1) + " " + (res1.b.idx + 1));
        } else if(num == 2) {
            System.out.println((res2.a.idx + 1) + " " + (res2.b.idx + 1));
            System.out.println((res2.a.idx2 + 1) + " " + (res2.b.idx2 + 1));
        }
    }

    private static Res optimize(long sdelta, Tuple[] a, Tuple[] b) {
        Tuple mini, minj;
        mini = null;
        minj = null;
        long min = Math.abs(sdelta);
        Arrays.sort(b);
        for(int i = 0; i < a.length && b.length > 0; i++) {
            long d = sdelta - a[i].v;
            Tuple m = tryAbs(d, b);
            if(m.v < min) {
                min = m.v;
                mini = a[i]; 
                minj = b[m.idx];
            }
        }
        return new Res(min, mini, minj);
    }
    private static Tuple tryAbs(long d, Tuple[] b) {
        int j = Arrays.binarySearch(b, new Tuple(-d, -1));
        Tuple m = null;
        if(j < 0) {
            int j1 = -j - 1;
            int j2 = -j - 2;
            j1 = Math.max(0, Math.min(j1, b.length - 1));
            j2 = Math.max(0, Math.min(j2, b.length - 1));
            long m1 = Math.abs(d + b[j1].v);
            long m2 = Math.abs(d + b[j2].v); 
            j = (m1 < m2 ? j1 : j2);
        } 
        m = new Tuple(Math.abs(d + b[j].v), j);
        return m;
    }

    static class Tuple implements Comparable {
        long v;
        int idx, idx2;
        Tuple(long v, int idx) {
            this.v = v;
            this.idx = idx;
            this.idx2 = -1;
        }
        Tuple(long v, int idx, int idx2) {
            this.v = v;
            this.idx = idx;
            this.idx2 = idx2;
        }
        public int compareTo(Object o) {
            Tuple t = (Tuple)o;
            return Long.valueOf(this.v).compareTo(Long.valueOf(t.v));
        }
        public boolean equals(Object o) {
            return this.v == ((Tuple)o).v;
        }
        public String toString() {
            return "(" + v + ", " + idx +  (idx2 != -1 ? ", " + idx2 : "") + ")";
        }
    }
    static class Res {
        long s;
        Tuple a;
        Tuple b;
        Res(long s, Tuple a, Tuple b) {
            this.s = s;
            this.a = a;
            this.b = b;
        }
    }
}
