Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.

The park is a rectangular table with n rows and m columns, where the cells of the table are squares, and the boundaries between the cells are streets. External borders are also streets. Every street has length 1. For example, park with n=m=2 has 12 streets.

You were assigned to develop a plan for lighting the park. You can put lanterns in the middle of the streets. The lamp lights two squares near it (or only one square if it stands on the border of the park).

<image> The park sizes are: n=4, m=5. The lighted squares are marked yellow. Please note that all streets have length 1. Lanterns are placed in the middle of the streets. In the picture not all the squares are lit.

Semyon wants to spend the least possible amount of money on lighting but also wants people throughout the park to keep a social distance. So he asks you to find the minimum number of lanterns that are required to light all the squares.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases in the input. Then t test cases follow.

Each test case is a line containing two integers n, m (1 ≤ n, m ≤ 10^4) — park sizes.

Output

Print t answers to the test cases. Each answer must be a single integer — the minimum number of lanterns that are required to light all the squares.

Example

Input


5
1 1
1 3
2 2
3 3
5 3


Output


1
2
2
5
8

Note

Possible optimal arrangement of the lanterns for the 2-nd test case of input data example: <image>

Possible optimal arrangement of the lanterns for the 3-rd test case of input data example: <image>
import java.io.*;
import java.util.*;

public class solution {
    static class sort implements Comparator<ArrayList<Integer>> {

        @Override
        public int compare(ArrayList<Integer> o1, ArrayList<Integer> o2) {
            int c = o2.get(1).compareTo(o1.get(1));
            if (c == 0) {

                c = o2.get(0).compareTo(o1.get(0));
            }
            return c;
        }
    }

    public static void merge(long arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        long L[] = new long[n1];
        long R[] = new long[n2];
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    public static void sort(long arr[], int l, int r) {
        if (l < r) {
            int m = (l + r) / 2;
            sort(arr, l, m);
            sort(arr, m + 1, r);
            merge(arr, l, m, r);
        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        } else return gcd(b, a % b);
    }

    public static long lcm(long a, long b) {
        long gcd = gcd(a, b);
        long pord = a * b;
        return pord / gcd;
    }

    static class graphs {
        private int V;
        private ArrayList<Integer> adj[];

        graphs(int v) {
            V = v;
            adj = new ArrayList[v];
            for (int i = 0; i < v; i++) {
                adj[i] = new ArrayList<>();
            }
        }

        void addedge(int u, int v) {
            adj[u].add(v);
        }

        void BFS(int v) {
            boolean visited[] = new boolean[V];
            Queue<Integer> Q = new LinkedList<>();
            visited[v] = true;
            Q.add(v);
            while (!Q.isEmpty()) {
                int temp = Q.peek();
                System.out.print(temp + " ");
                Q.remove();
                Iterator<Integer> it = adj[temp].listIterator();
                while (it.hasNext()) {
                    int n = it.next();
                    if (!visited[n]) {
                        visited[n] = true;
                        Q.add(n);
                    }
                }
            }
        }

        void DFSUtil(int v, boolean visited[]) {
            visited[v] = true;
            System.out.print(v + " ");
            Iterator<Integer> it = adj[v].listIterator();
            while (it.hasNext()) {
                int n = it.next();
                if (!visited[n]) {
                    DFSUtil(n, visited);
                }
            }
        }

        void DFS(int v) {
            boolean visited[] = new boolean[V];
            DFSUtil(v, visited);
        }
    }

    public static int Binaraysearch(long a[], int low, int high, long key) {
        while (low <= high) {
            int mid = low + (high - low) / 2;
            if (a[mid] == key) {
                return mid;
            } else if (a[mid] < key) {
                low = mid;
            } else {
                high = mid;
            }
        }
        return -1;
    }

    public static void seive(boolean prime[]) {
        Arrays.fill(prime, true);
        int n = prime.length - 1;
        for (int p = 2; p * p <= n; p++) {
            if (prime[p] == true) {
                for (int i = p * p; i <= n; i += p)
                    prime[i] = false;
            }
        }
    }

    public static boolean random(long a, long b) {
        return a < b;
    }

    public static int subArraySum(int arr[], int n, int sum) {
        int curr_sum = arr[0], start = 0, i;
        for (i = 1; i <= n; i++) {
            // If curr_sum exceeds the sum, then remove the starting elements
            while (curr_sum > sum && start < i - 1) {
                curr_sum = curr_sum - arr[start];
                start++;
            }

            // If curr_sum becomes equal to sum, then return true
            if (curr_sum == sum) {
                int p = i - 1;
                if (p != start)
                    return 1;
            }

            // Add this element to curr_sum
            if (i < n)
                curr_sum = curr_sum + arr[i];

        }
        return 0;
    }

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       int t = Integer.parseInt(br.readLine());
       for(int ii=0;ii<t;ii++){
           StringTokenizer st = new StringTokenizer(br.readLine());
           long a = Long.parseLong(st.nextToken());
           long b = Long.parseLong(st.nextToken());
           long n = a*b;
           System.out.println(n/2+n%2);
       }
    }
}