Note to plugin users: There are images in this problem statement, please use the applet to view them
Three cushion billiards is a form of Carombole, a French game of billiards. The game is played on a standard billiard table with no pockets, and with three balls: two white cue balls and one red ball. Each player must hit his/her own cue ball such that it hits at least three cushions (or sides), the opponent's cue ball, and the red ball. The cue ball can hit the cushions and the other two balls in any order, but it must hit the cushions before the last ball is hit. These cushions need not be different. For example, you could hit one cushion, then the opposite, then hit the first cushion again, and this counts as 3 cushions.
We're going to invent a new game called NCushion billiards, where you only have to hit your opponent's cue ball (there is no red ball), but the number of cushions you must hit before hitting the opponent's ball can be up to 500. In the original game, you could hit more than three cushions, but in this game, you must hit the specified number of cushions exactly.
When a ball bounces off a cushion, the path the ball takes is very similar to light reflecting off a mirror. The image below shows a ball (in red) "reflecting" off a cushion. Notice how the angle of incidence (designated by the ? symbol) is the same on both sides of the reflection.
When a ball goes exactly into a corner, the ball hits both cushions simultaneously (this counts as hitting two cushions), and reflects back exactly in the opposite direction.
Our coordinate system is going to be in millimeters, and points will be written as (X,Y). The table is 2 meters by 1 meter, with the long side lying on the Xaxis. The lower left corner is given the coordinate (0,0) and the upper right corner is given the coordinate (2000,1000). You will be given two coordinates in a int[] cue representing your ball, and a int[] opponent representing your opponent's ball. Each int[] will contain exactly 2 elements, the first being the X position, and the second being the Y position. Finally, you will be given an int N, which is the number of cushions your ball must hit before htting the opponent's ball. Your method must return the number of different directions in which you can hit your ball so that it hits the given number of cushions and finally hits the opponent's ball. For the purposes of this problem, assume the balls have no physical size, but are just points in space  this means your ball must hit the other ball dead on in order to hit it. Remember that your ball cannot pass through the other ball in order to hit the correct number of cushions (see Example 1).
