Vupsen and Pupsen were gifted an integer array. Since Vupsen doesn't like the number 0, he threw away all numbers equal to 0 from the array. As a result, he got an array a of length n.

Pupsen, on the contrary, likes the number 0 and he got upset when he saw the array without zeroes. To cheer Pupsen up, Vupsen decided to come up with another array b of length n such that ∑_{i=1}^{n}a_i ⋅ b_i=0. Since Vupsen doesn't like number 0, the array b must not contain numbers equal to 0. Also, the numbers in that array must not be huge, so the sum of their absolute values cannot exceed 10^9. Please help Vupsen to find any such array b!

Input

The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases. The next 2 ⋅ t lines contain the description of test cases. The description of each test case consists of two lines.

The first line of each test case contains a single integer n (2 ≤ n ≤ 10^5) — the length of the array.

The second line contains n integers a_1, a_2, …, a_n (-10^4 ≤ a_i ≤ 10^4, a_i ≠ 0) — the elements of the array a.

It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case print n integers b_1, b_2, …, b_n — elements of the array b (|b_1|+|b_2|+… +|b_n| ≤ 10^9, b_i ≠ 0, ∑_{i=1}^{n}a_i ⋅ b_i=0).

It can be shown that the answer always exists.

Example

Input


3
2
5 5
5
5 -2 10 -9 4
7
1 2 3 4 5 6 7


Output


1 -1
-1 5 1 -1 -1
-10 2 2 -3 5 -1 -1

Note

In the first test case, 5 ⋅ 1 + 5 ⋅ (-1)=5-5=0. You could also print 3 -3, for example, since 5 ⋅ 3 + 5 ⋅ (-3)=15-15=0

In the second test case, 5 ⋅ (-1) + (-2) ⋅ 5 + 10 ⋅ 1 + (-9) ⋅ (-1) + 4 ⋅ (-1)=-5-10+10+9-4=0.
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static int MOD = 1000000007;

    // After writing solution, quick scan for:
    //   array out of bounds
    //   special cases e.g. n=1?
    //   npe, particularly in maps
    //
    // Big numbers arithmetic bugs:
    //   int overflow
    //   sorting, or taking max, after MOD
    void solve() throws IOException {
        int T = ri();
        // test n = 2, n = 3
        for (int Ti = 0; Ti < T; Ti++) {
            int n = ri();
            int[] a = ril(n);

            if (n == 2) {
                pw.println(a[1] + " " + (-a[0]));
                continue;
            }

            int g = Math.abs(a[0]);
            for (int ai : a) g = gcd(g, Math.abs(ai));
            for (int i = 0; i < n; i++) a[i] /= g;

            int idx1 = -1;
            for (int i = 0; i < n; i++) {
                if (a[i] == 1 || a[i] == -1) {
                    idx1 = i;
                    break;
                }
            }

            if (idx1 != -1) {
                int sum = 0;
                int[] b = new int[n];
                for (int i = 0; i < n; i++) {
                    if (i == idx1) continue;
                    if (a[i] > 0) {
                        if (sum >= 0) {
                            sum -= a[i];
                            b[i] = -1;
                        } else {
                            sum += a[i];
                            b[i] = 1;
                        }
                    } else {
                        if (sum >= 0) {
                            sum += a[i];
                            b[i] = 1;
                        } else {
                            sum -= a[i];
                            b[i] = -1;
                        }
                    }
                }
                if (sum == 0) {
                    int other = idx1 == 0 ? 1 : 0;
                    if (b[other] == 1) {
                        b[other]++;
                        sum += b[other];
                    } else if (b[other] == -1) {
                        b[other]--;
                        sum -= b[other];
                    }
                }
                // sum is non non-zero
                if (a[idx1] == 1) {
                    b[idx1] = -sum;
                } else {
                    b[idx1] = sum;
                }
                for (int i = 0; i < n; i++) b[i] *= g;
                for (int bi : b) pw.print(bi + " ");
                pw.println();
                continue;
            }

            // no 1s

            int sum = 0;
            int[] b = new int[n];
            for (int i = 0; i < n-2; i++) {
                if (a[i] > 0) {
                    if (sum >= 0) {
                        sum -= a[i];
                        b[i] = -1;
                    } else {
                        sum += a[i];
                        b[i] = 1;
                    }
                } else {
                    if (sum >= 0) {
                        sum += a[i];
                        b[i] = 1;
                    } else {
                        sum -= a[i];
                        b[i] = -1;
                    }
                }
            }
            if (sum == 0) {
                int other = 0;
                if (b[other] == 1) {
                    b[other]++;
                    sum += b[other];
                } else if (b[other] == -1) {
                    b[other]--;
                    sum -= b[other];
                }
            }
            // sum is nonzero

            pw.println(sum);

            // create a "1" with the last 2 elements
            int[] xy = new int[2];
            extgcd(a[n-2], a[n-1], xy);
            int x = xy[0];
            int y = xy[1];

            boolean invert = false;
            if (a[n-2] * x + a[n-1] * y == 1) invert = false;
            else invert = true;

            if (sum > 0) {
                if (!invert) {
                    b[n-2] = -x;
                    b[n-1] = -y;
                } else {
                    b[n-2] = x;
                    b[n-1] = y;
                }
            } else {
                if (!invert) {
                    b[n-2] = x;
                    b[n-1] = y;
                } else {
                    b[n-2] = -x;
                    b[n-1] = -y;
                }
            }
            b[n-2] *= Math.abs(sum);
            b[n-1] *= Math.abs(sum);

            for (int i = 0; i < n; i++) {
                b[i] *= g;
            }
            for (int bi : b) pw.print(bi + " ");
            pw.println();



            // DONT FORGET re-multiply g back

            // if 1 exists, then easy.
            // if gcd(all elements) is not 1, then "divide out" the gcd
            // now there are two elements that are relatively prime
            // we can manufacture a 1 using extended gcd. how costly is this? at most 2 * 10^4.
        }
    }
    // IMPORTANT
    // DID YOU CHECK THE COMMON MISTAKES ABOVE?

    public static int gcd(int a, int b) {
        return a == 0 ? b : gcd(b % a, a);
    }

    int extgcd(int a, int b, int[] xy) {
        if (b == 0) {
            xy[0] = 1;
            xy[1] = 0;
            return a;
        }
        int[] xy1 = new int[2];
        int d = extgcd(b, a % b, xy1);
        int x1 = xy1[0];
        int y1 = xy1[1];
        xy[0] = y1;
        xy[1] = x1 - y1 * (a / b);
        return d;
    }

    // Template code below

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        Main m = new Main();
        m.solve();
        m.close();
    }

    void close() throws IOException {
        pw.flush();
        pw.close();
        br.close();
    }

    int ri() throws IOException {
        return Integer.parseInt(br.readLine().trim());
    }

    long rl() throws IOException {
        return Long.parseLong(br.readLine().trim());
    }

    int[] ril(int n) throws IOException {
        int[] nums = new int[n];
        int c = 0;
        for (int i = 0; i < n; i++) {
            int sign = 1;
            c = br.read();
            int x = 0;
            if (c == '-') {
                sign = -1;
                c = br.read();
            }
            while (c >= '0' && c <= '9') {
                x = x * 10 + c - '0';
                c = br.read();
            }
            nums[i] = x * sign;
        }
        while (c != '\n' && c != -1) c = br.read();
        return nums;
    }

    long[] rll(int n) throws IOException {
        long[] nums = new long[n];
        int c = 0;
        for (int i = 0; i < n; i++) {
            int sign = 1;
            c = br.read();
            long x = 0;
            if (c == '-') {
                sign = -1;
                c = br.read();
            }
            while (c >= '0' && c <= '9') {
                x = x * 10 + c - '0';
                c = br.read();
            }
            nums[i] = x * sign;
        }
        while (c != '\n' && c != -1) c = br.read();
        return nums;
    }

    int[] rkil() throws IOException {
        int sign = 1;
        int c = br.read();
        int x = 0;
        if (c == '-') {
            sign = -1;
            c = br.read();
        }
        while (c >= '0' && c <= '9') {
            x = x * 10 + c - '0';
            c = br.read();
        }
        return ril(x);
    }

    long[] rkll() throws IOException {
        int sign = 1;
        int c = br.read();
        int x = 0;
        if (c == '-') {
            sign = -1;
            c = br.read();
        }
        while (c >= '0' && c <= '9') {
            x = x * 10 + c - '0';
            c = br.read();
        }
        return rll(x);
    }

    char[] rs() throws IOException {
        return br.readLine().toCharArray();
    }

    void sort(int[] A) {
        Random r = new Random();
        for (int i = A.length-1; i > 0; i--) {
            int j = r.nextInt(i+1);
            int temp = A[i];
            A[i] = A[j];
            A[j] = temp;
        }
        Arrays.sort(A);
    }

    void printDouble(double d) {
        pw.printf("%.16f", d);
    }
}