JOIN

 Problem Statement

Problem Statement for LotsOfLines

### Problem Statement

Note that the memory limit for all tasks in this SRM is 256 MB.

You are given ints A and B. These determine a set of A*B lines in the plane: for each pair of integers (a,b) such that 0 <= a < A and 0 <= b < B, there is a line with the equation y=ax+b.

These lines divide the plane into several regions. (Some of them are finite, some are infinite.) Compute and return the total number of regions.

### Definition

 Class: LotsOfLines Method: countDivisions Parameters: int, int Returns: long Method signature: long countDivisions(int A, int B) (be sure your method is public)

### Notes

-Formally, the line with the equation y=ax+b is the set of all points (x,y) such that x is any real number and y=ax+b.

### Constraints

-A will be between 1 and 1,200, inclusive.
-B will be between 1 and 1,200, inclusive.

### Examples

0)

 `1` `1`
`Returns: 2`
 There is only one line: y=0. This line divides the plane into two regions.
1)

 `2` `2`
`Returns: 9`
 There are four lines. The plane looks as follows.
2)

 `3` `2`
`Returns: 17`
3)

 `1` `1200`
`Returns: 1201`
 There are 1,200 horizontal lines.
4)

 `5` `9`
`Returns: 638`

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
Single Round Match 600 Round 1 - Division I, Level Three