UVA11657 Rational Billiard

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=78&page=show_problem&problem=2704 [PDF](https://uva.onlinejudge.org/external/116/p11657.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11657/9b8238e9259cb01849bf7d778bf600d7bc5cd118.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11657/d4f703c3aac6eb05d55142892896645c5039dd1b.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11657/bf18da61f29b1268eacf40efae4015249e66cdbd.png)