### Problem Statement

A polygon is a closed plane figure with n>2 sides. In this problem, a polygon will be given as int[]s xs and ys. The kth point of the polygon will have, as x and y coordinates, the kth elements of xs and ys respectively. There will be an edge between every two consecutive points given. In addition, there will be an edge between the first and last points given.

A dilation is a transformation in plane geometry that takes every point of a figure, and multiplies its x and y coordinates by a given factor. A dilation by a factor greater than 1 acts to "blow-up" a figure, increasing its size proportionally.

An orthogonal shift is a transformation applied to a plane figure that moves it along a line that is perpendicular to its face. Consider a figure drawn in the x-y plane. An orthogonal shift would change this figure's z-coordinate by the given shift amount.

In this problem we are going to form a 3-dimensional solid object using a polygon, a dilation, and an orthogonal shift. The base of the solid will be the polygon given by xs and ys. The top face will be a dilated copy of the base that has been shifted in a direction orthogonal to the plane of the base. In other words, the bottom and top of the solid will be parallel polygons separated by an integral amount. The top face will be a proportionate copy of the bottom face. To complete the solid, edges will be drawn from every vertex in the base to its corresponding vertex in the dilated top face. For example:
```xs = {0,1,1,0}
ys = {0,0,1,1}
factor = 3
shift = 5
```
The base of the figure corresponding to the input shown above will be a square including the points (0,0),(1,0),(1,1),(0,1). Dilating this square by a factor of three will produce the polygon with points (0,0),(3,0),(3,3),(0,3). Note, to produce this dilation we multiplied every coordinate by the given factor. This larger square will be shifted 5 units in the z-direction (orthogonal to the base). The resultant figure is finished by drawing edges between each point and its corresponding point in the shifted and dilated copy. If thought about in 3-dimensions, the base would have points each having a z-coordinate of 0, whereas the top would have points each having a z-coordinate of 5. The edges would connect (0,0,0) to (0,0,5), (1,0,0) to (3,0,5), (1,1,0) to (3,3,5), and (0,1,0) to (0,3,5). Had factor been 1, the resulting object would instead have been a rectangular solid.

Your method will return the surface area of the resulting solid rounded down. The surface area is calculated by adding together the areas of the base, the top, and the faces generated by the edges connecting the base and top.

### Definition

 Class: SolidArea Method: totalArea Parameters: int[], int[], int, int Returns: int Method signature: int totalArea(int[] xs, int[] ys, int factor, int shift) (be sure your method is public)

### Constraints

-xs will contain between 3 and 50 elements inclusive
-xs and ys will contain the same number of elements
-factor will be between 1 and 50 inclusive
-shift will be between 1 and 50 inclusive
-Each element of xs will be between -100 and 100 inclusive
-Each element of ys will be between -100 and 100 inclusive
-There will be no repeated points
-No two non-consecutive edges in the resulting polygon may intersect with each other
-No two consecutive edges in the resulting polygon may have the same slope
-The resulting surface area prior to rounding will not be within .001 of an integer

### Examples

0)

 `{0,1,1,0}` `{0,0,1,1}` `3` `5`
`Returns: 51`
 The example from above. Given areas are approximates rounded for brevity: Base area = 1.0 Top area = 9.0 Face areas = 10.0, 10.7703, 10.7703, 10.0
1)

 `{-1,1,1,-1}` `{-1,-1,1,1}` `2` `1`
`Returns: 36`
 The base is a square centered at the origin. The top has been dilated by a factor of 2 and shifted 1 unit. Given areas are approximates rounded for brevity: Base area = 4.0 Top area = 16.0 Face areas = 4.243, 4.243, 4.243, 4.243
2)

 `{0,2,6,6,8,8,6,2,2,0}` `{10,10,6,10,10,0,0,4,0,0}` `9` `9`
`Returns: 14993`
 This base is a polygon resembling the letter N. The top has been dilated by a factor of 9 and shifted 9 units. Given areas are approximates rounded for brevity: Base area = 64.0 Top area = 5184.0 Face areas = 805.047, 1936.801, 976.729, 805.047, 3231.486, 90.0, 993.177, 367.151, 90.0, 450.0
3)

 `{-100,100,100,-100}` `{-100,-100,100,100}` `50` `50`
`Returns: 200005203`
4)

 `{0,1,3,1,3,0,-3,-1,-3,-1}` `{3,1,1,-1,-3,-2,-3,-1,1,1}` `10` `9`
`Returns: 3601`

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=911

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=4474&pm=911

brett1479

#### Testers:

lbackstrom , schveiguy

Geometry