Polyhedron
Time limit5sMemory limit256 MB
For each test case, compute the face count of a convex polyhedron from V and E with Euler formula F = 2 - V + E.
- Level
Easy1 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem

A mathematician carved a sphere into a convex polyhedron. Writing for the number of vertices, for the number of edges and for the number of faces, he knows that every convex polyhedron satisfies . 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 and , find the number of faces of the convex polyhedron.
Input
The first line contains a natural number . ()
Each of the next lines contains two natural numbers and separated by a space. (, ) is the number of vertices and is the number of edges.
Output
For each and , print the number of faces of the convex polyhedron on its own line.