This page is still under construction.

Parts of this page are still being built. What you see may change.

Mountain Shelter

Time limit1sMemory limit128 MB

Summary
Compute the maximum number of dominoes that fit in a W by K grid for up to 10 test cases.
Level

Easy1 of 10

Topics
Math
Solved
No attempts yet

Problem

While Hektor was busy working on the HektorJudge project, his colleague Wiktor decided that life should not consist only of sitting in front of a computer, so he set off on a trip to the mountains. When he reached the mountain shelter in the evening, he was surprised to find that he was not the only one who had thought of spending the weekend in the mountains: the shelter was packed with tourists!

In this awkward situation, the shelter's manager had to arrange for the tourists to sleep on the floor of the shelter's main hall. The hall is a rectangle made up of W×KW \times K square cells arranged in WW rows and KK columns. Each tourist occupies exactly two adjacent cells (touching either horizontally or vertically). What is the maximum number of tourists that can be placed in a hall of the given size so that each cell is used by at most one tourist? Wiktor, being skilled in mathematics and computer science, immediately worked out the correct answer.

Input

The first line contains a natural number ZZ (1≤Z≤101 \le Z \le 10), the number of test sets. The test sets follow, one after another.

Each test set consists of a single line containing two positive integers WW and KK (1≤W,K≤10001 \le W, K \le 1000), separated by a single space.

Output

For each test set, print on its own line the maximum number of tourists who can sleep in the shelter hall at the same time. The order of the printed answers must match the order of the test sets in the input.

Examples1

  1. Example 1

    Input
    3
    1 1
    2 2
    2 3
    
    Expected output
    0
    2
    3