Polyhedron

No attempts yetTime limit5sMemory limit256 MB

Problem

A mathematician carved a sphere into a convex polyhedron. Writing VV for the number of vertices, EE for the number of edges and FF for the number of faces, he knows that every convex polyhedron satisfies VE+F=2V - E + F = 2. Carving spheres is his hobby, so when he writes down a record he counts only the vertices and the edges and never the faces.

Given the recorded VV and EE, find the number of faces of the convex polyhedron.

Input

The first line contains a natural number TT. (1T1001 \le T \le 100)

Each of the next TT lines contains two natural numbers VV and EE separated by a space. (4V1004 \le V \le 100, 4E1004 \le E \le 100) VV is the number of vertices and EE is the number of edges.

Output

For each VV and EE, print the number of faces of the convex polyhedron on its own line.