cho.sh
Notes
Loading...

Lattice Convex Polygon

Time limit

2s

Memory limit

128 MB

Problem

Consider the rectangle whose opposite corners are (0, 0) and (M, N). We want to draw a convex polygon inside this rectangle. Every vertex of the polygon must have integer coordinates, and each vertex may lie either inside the rectangle or on its boundary.

Given the rectangle size M and N, find the maximum possible number of vertices of such a convex polygon.

Input

The first line contains two natural numbers M and N, separated by a space. Both M and N are at least 3 and at most 200.

Output

Print the maximum possible number of vertices of a convex polygon that can be drawn.