HARDFLOR
HARDFLOR, Inc. is in the business of laying terrazzo floors. They charge by the square foot of flooring laid. They are very good at laying floors, but they have some difficulty in calculating the areas because floors come in many shapes and sizes, e.g.,
One rule that John Hardflor, the company’s founder, made years ago was to “never bid on a job that doesn’t have square corners”. And, the company still follows that rule. They are still having trouble estimating areas, however, and they would like to have a computer program developed which would assist them in this endeavour.
The company’s estimator would like to go out on a potential job and measure the dimensions of the room and code them in the following way: He starts with an arbitrary corner. He lists a succession of direction distance pairs. (Directions are always N, S, E, W and distances are always in feet). e.g. a room with dimensions as shown
might be coded with the following set of pairs: [(N,9),(E,16),(N,4),(E,7),(S,13),(W,23)].
Write a program which will determine the area.
Input
The first line of input contains a single integer $N$ ($4 \leq N < 12$) indicating the number of corners in the room. The second line contains $N$ direction-distance pairs where each is given as a concatenation of the direction with the distance. Each distance $d$ satisfies $1 \leq d < 100$.
Assume that the input is correct – you will always end up at the corner on which you started, that every direction is at a right angle from the previous direction (including the first direction from the last direction), and that the room being described is a simple polygon (i.e. lines do not cross and the only lines that touch are those at one of the described corners).
Output
Output a single line with the text THE AREA IS <A> where $\texttt{<A>}$ is the square footage of the room.
| Sample Input 1 | Sample Output 1 |
|---|---|
6 N9 E16 N4 E7 S13 W23 |
THE AREA IS 235 |