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.util.*;
import java.io.*;
public class Main {
    static FastReader in=new FastReader();
    static StringBuilder Sd=new StringBuilder();
    
    public static void main(String [] args) {
    	//Dir by MohammedElkady
    	int t=in.nextInt();
    	while(t-->0) {
    		long n=in.nextLong(),m=in.nextLong();
    		Soutln(((n*m)+1)/2+"");
    	}
    Sclose();  
}
    static long gcd(long g,long x){
        if(x<1)return g;
        else return gcd(x,g%x);
    }
    //array fill
    static long[]filllong(int n){long a[]=new long[n];for(int i=0;i<n;i++)a[i]=in.nextLong();return a;}
    static int[]fillint(int n){int a[]=new int[n];for(int i=0;i<n;i++)a[i]=in.nextInt();return a;}
    //OutPut Line
    static void Sout(String S) {Sd.append(S);}
    static void Soutln(String S) {Sd.append(S+"\n");}
    static void Soutf(String S) {Sd.insert(0, S);}
    static void Sclose() {System.out.println(Sd);}
    static void Sclean() {Sd=new StringBuilder();}
}
class node implements Comparable<node>{
int x,t;
	node(int x,int p){
		this.x=x;
		this.t=p;
	}
	@Override
	public int compareTo(node o) {
       return (t-o.t);
	}
}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}
 
class Sorting{
	 
	 public static int[] bucketSort(int[] array, int bucketCount) {
	 
	 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");
	 
	 if (array.length <= 1) return array; //trivially sorted
	 
	 
	 
	 int high = array[0];
	 
	 int low = array[0];
	 
	 for (int i = 1; i < array.length; i++) { //find the range of input elements
	 
	 if (array[i] > high) high = array[i];
	 
	 if (array[i] < low) low = array[i];
	 
	 }
	 
	 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket
	 
	 
	 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];
	 
	 for (int i = 0; i < bucketCount; i++) { //initialize buckets
	 
	 buckets[i] = new ArrayList();
	 
	 }
	 
	 
	 
	 for (int i = 0; i < array.length; i++) { //partition the input array
	 
	 buckets[(int)((array[i] - low)/interval)].add(array[i]);
	 
	 }
	 
	 
	 int pointer = 0;
	 
	 for (int i = 0; i < buckets.length; i++) {
	 
	 Collections.sort(buckets[i]); //mergeSort
	 
	 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets
	 
	 array[pointer] = buckets[i].get(j);
	 
	 pointer++;
	 
	 }
	 
	}
	 
	return array;
	 
	}
	}