Billiard again

In a billiard table with a horizontal side a inches long and vertical side b inches long, a ball is launched from the middle of the table with initial velocity v inches per second and launching angle A between 0 and 90 degrees measured counter-clockwise from the horizontal. Before the first bounce, the ball increases its distance from the lower left corner of the table. What is the shortest distance between the path of the ball and a point in the billiard table given by planar coordinates x and y? Assume, that the lower left corner of the table has coordinates < 0, 0 >. Assume that the collisions with a side are elastic (no energy loss), and thus the velocity component of the ball parallel to each side remains unchanged after the bounce. However, due to friction the ball decelerates at a constant rate and comes to a full stop after s > 0 seconds. Assume the ball has a radius of zero. Remember that, unlike pool tables, billiard tables have no pockets. Input Input consists of a sequence of lines, each containing seven nonnegative integers separated by whitespace. Thesevennumbersare: 0<a≤100,0<b≤100,0<v≤100,0≤A≤90,0<s≤200,0≤x≤a, and 0 ≤ y ≤ b, respectively. Input is terminated by a line containing seven zeroes. Output For each input line except the last, output a line containing one real number (accurate to two decimal places). The number is the measure in inches of the shortest distance between the ball and the point < x, y >. Sample Input 100 50 10 90 10 0 0 100 100 10 45 15 0 0 100 100 10 30 200 31 48 0000000 Sample Output 55.90 70.71 2.04