## Team Composition: Programmers and Mathematicians solution codechef

The All-Berland Team Programming Contest will take place very soon. This year, teams of four are allowed to participate.

There areÂ đť‘ŽaÂ programmers andÂ đť‘ŹbÂ mathematicians at Berland State University. How many maximum teams can be made if:

- each team must consist of exactlyÂ 44Â students,
- teams ofÂ 44Â mathematicians orÂ 44Â programmers are unlikely to perform well, so the decision was made not to compose such teams.

Thus, each team must have at least one programmerÂ andÂ at least one mathematician.

Print the required maximum number of teams. Each person can be a member of no more than one team.

Also read: ATM and Students solution codeforces

The first line contains an integerÂ đť‘ˇtÂ (1â‰¤đť‘ˇâ‰¤1041â‰¤tâ‰¤104)Â â€”the number of test cases.

This is followed by descriptions ofÂ đť‘ˇtÂ sets, one per line. Each set is given by two integersÂ đť‘ŽaÂ andÂ đť‘ŹbÂ (0â‰¤đť‘Ž,đť‘Źâ‰¤1090â‰¤a,bâ‰¤109).

PrintÂ đť‘ˇtÂ lines. Each line must contain the answer to the corresponding set of input dataÂ â€” the required maximum number of teams.

input

6 5 5 10 1 2 3 0 0 17 2 1000000000 1000000000

output

Also read: Make Even solution codeforces

2 1 1 0 2 500000000

In the first test case of the example, two teams can be composed. One way to compose two teams is to compose two teams ofÂ 22Â programmers andÂ 22Â mathematicians.

In the second test case of the example, only one team can be composed:Â 33Â programmers andÂ 11 mathematician in the team.