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

//package cf;


import java.io.*;
import java.util.*;

public class D {

    public static void main(String[] args) {
        DIO io = new DIO();
        try {
            Dsolver solver = new Dsolver(io);
        } finally {
            io.close();
        }
    }

}

class Dsolver {

    public Dsolver(DIO io) {
        int n = io.nextInt();
        long goal = 0;
        int[] a = new int[n+1];
        for (int i=1; i<=n; i++) {
            a[i] = io.nextInt();
            goal += a[i];
        }
        int m = io.nextInt();
        int[] b = new int[m+1];
        for (int i=1; i<=m; i++) {
            b[i] = io.nextInt();
            goal -= b[i];
        }
        
        // Case: no swaps
        long bestKnownValue = Math.abs(goal);
        int bestKnownSwapCount = 0;
        String bestKnownSwaps = "";
        
        // Case: 1 swap
        for (int i=1; i<=n; i++) {
            for (int j=1; j<=m; j++) {
                long value = Math.abs(goal - 2 * a[i] + 2 * b[j]);
                if (value < bestKnownValue) {
                    bestKnownValue = value;
                    bestKnownSwapCount = 1;
                    bestKnownSwaps = i + " " + j + "\n";
                }
            }
        }

        // Case: 2 swaps
        ArrayList<Pari> parit = new ArrayList<>();
        for (int i=1; i<a.length; i++) {
            for (int j=i+1; j<a.length; j++) {
                long summa = 0L;
                summa += a[i];
                summa += a[j];
                Pari pari = new Pari(i, j, summa);
                parit.add(pari);
            }
        }
        Collections.sort(parit);
        for (int i=1; i<b.length; i++) {
            if (parit.isEmpty()) break;
            for (int j=i+1; j<b.length; j++) {
                // Halutaan vaihtaa b:n indeksit i ja j johonkin pariin A:sta
                Long beenSumma = b[i] + 0L + b[j];
                Long etsittava = (goal + 2*beenSumma);
                
                int min=0;
                int max=parit.size()-1;
                while (max - min > 1) {
                    int keski = (min+max)/2;
                    Pari p = parit.get(keski);
                    long value = p.sum2x - etsittava;
                    if (value < 0) {
                        min = keski;
                    } else {
                        max = keski;
                    }
                }

                Pari p = parit.get(min);
                if (Math.abs(p.sum2x-etsittava) < bestKnownValue) {
                    bestKnownValue = Math.abs(p.sum2x-etsittava);
                    bestKnownSwapCount = 2;
                    bestKnownSwaps = p.a + " " + i + "\n"
                                   + p.b + " " + j + "\n";
                }
                p = parit.get(max);
                if (Math.abs(p.sum2x-etsittava) < bestKnownValue) {
                    bestKnownValue = Math.abs(p.sum2x-etsittava);
                    bestKnownSwapCount = 2;
                    bestKnownSwaps = p.a + " " + i + "\n"
                                   + p.b + " " + j + "\n";
                }
            }
        }
        
        io.println(bestKnownValue);
        io.println(bestKnownSwapCount);
        io.println(bestKnownSwaps);
    }
    
}

class Pari implements Comparable<Pari> {
    int a;
    int b;
    long sum2x;

    public Pari(int a, int b, long sum) {
        this.a = a;
        this.b = b;
        this.sum2x = 2 * sum; // !!!!!!!!!!!!!!!
    }

    @Override
    public int compareTo(Pari o) {
        if (this.sum2x < o.sum2x) return -1;
        if (this.sum2x > o.sum2x) return 1;
        return 0;
    }
    
}

class DIO extends PrintWriter {
    private InputStreamReader r;
    private static final int BUFSIZE = 1 << 15;
    private char[] buf;
    private int bufc;
    private int bufi;
    private StringBuilder sb;

    public DIO() {
            super(new BufferedOutputStream(System.out));
            r = new InputStreamReader(System.in);

            buf = new char[BUFSIZE];
            bufc = 0;
            bufi = 0;
            sb = new StringBuilder();
    }

    private void fillBuf() throws IOException {
            bufi = 0;
            bufc = 0;
            while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                            bufc = 0;
                            return;
                    }
            }
    }

    private boolean pumpBuf() throws IOException {
            if(bufi == bufc) {
                    fillBuf();
            }
            return bufc != 0;
    }

    private boolean isDelimiter(char c) {
            return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
    }

    private void eatDelimiters() throws IOException {
            while(true) {
                    if(bufi == bufc) {
                            fillBuf();
                            if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
            }
    }

    public String next() {
            try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                            if(bufi == bufc) {
                                    sb.append(buf, start, bufi - start);
                                    fillBuf();
                                    start = 0;
                                    if(bufc == 0) break;
                            }

                            if(isDelimiter(buf[bufi])) break;
                            ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
            } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
            }
    }

    public int nextInt() {
            try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                            ++bufi;
                            if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                            positive = false;
                    }

                    boolean first = true;
                    while(true) {
                            if(!pumpBuf()) break;
                            if(isDelimiter(buf[bufi])) {
                                    if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                                    break;
                            }
                            first = false;

                            if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                                    if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                                    ret *= 10;
                                    ret -= (int)(buf[bufi] - '0');
                                    if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                            } else {
                                    throw new RuntimeException("IO.nextInt: Invalid int.");
                            }

                            ++bufi;
                    }

                    if(positive) {
                            if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret = -ret;
                    }

                    return ret;
            } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
            }
    }

    public long nextLong() {
            try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                            ++bufi;
                            if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                            positive = false;
                    }

                    boolean first = true;
                    while(true) {
                            if(!pumpBuf()) break;
                            if(isDelimiter(buf[bufi])) {
                                    if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                                    break;
                            }
                            first = false;

                            if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                                    if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                                    ret *= 10;
                                    ret -= (long)(buf[bufi] - '0');
                                    if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                            } else {
                                    throw new RuntimeException("IO.nextLong: Invalid long.");
                            }

                            ++bufi;
                    }

                    if(positive) {
                            if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret = -ret;
                    }

                    return ret;
            } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
            }
    }

    public double nextDouble() {
            return Double.parseDouble(next());
    }

}