Cats and Vets

Let there be M vets (veterinarians) and N cats, where each cat has a different disease. Let all possible combinations of examinations of cats by vets take place. What is the minimum number of gloves needed so that no vet is exposed to any of the cat’s disease and no cat is exposed to a disease that the cat does not already have (where it is assumed that each vet wears a glove on his right hand only)? In this problem, the gloves can be turned inside out and even placed on top of one another if necessary without any limits on the number of gloves worn together, but no decontamination of gloves is permitted. Note that if a side of the glove touches either another side of a contaminated side of a glove or a cat, then that side of the glove become contaminated. Input A number of test cases (≤ 10000), one per line, each with M and N (M > 0 and N > 0, and each fit in 64 bit unsigned integer). Output Output the answer for each test case, one on each line. Sample Input 11 12 Sample Output 1 2