301074: CF203D. Hit Ball

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hit Ball

题目描述

When Valera was playing football on a stadium, it suddenly began to rain. Valera hid in the corridor under the grandstand not to get wet. However, the desire to play was so great that he decided to train his hitting the ball right in this corridor. Valera went back far enough, put the ball and hit it. The ball bounced off the walls, the ceiling and the floor corridor and finally hit the exit door. As the ball was wet, it left a spot on the door. Now Valera wants to know the coordinates for this spot. Let's describe the event more formally. The ball will be considered a point in space. The door of the corridor will be considered a rectangle located on plane $ xOz $ , such that the lower left corner of the door is located at point $ (0,0,0) $ , and the upper right corner is located at point $ (a,0,b) $ . The corridor will be considered as a rectangular parallelepiped, infinite in the direction of increasing coordinates of $ y $ . In this corridor the floor will be considered as plane $ xOy $ , and the ceiling as plane, parallel to $ xOy $ and passing through point $ (a,0,b) $ . We will also assume that one of the walls is plane $ yOz $ , and the other wall is plane, parallel to $ yOz $ and passing through point $ (a,0,b) $ . We'll say that the ball hit the door when its coordinate $ y $ was equal to $ 0 $ . Thus the coordinates of the spot are point $ (x_{0},0,z_{0}) $ , where $ 0<=x_{0}<=a,0<=z_{0}<=b $ . To hit the ball, Valera steps away from the door at distance $ m $ and puts the ball in the center of the corridor at point ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF203D/926534e341a195c576b439af3eb565130841d0c4.png). After the hit the ball flies at speed $ (v_{x},v_{y},v_{z}) $ . This means that if the ball has coordinates $ (x,y,z) $ , then after one second it will have coordinates $ (x+v_{x},y+v_{y},z+v_{z}) $ . See image in notes for clarification. When the ball collides with the ceiling, the floor or a wall of the corridor, it bounces off in accordance with the laws of reflection (the angle of incidence equals the angle of reflection). In the problem we consider the ideal physical model, so we can assume that there is no air resistance, friction force, or any loss of energy.

输入输出格式

输入格式


The first line contains three space-separated integers $ a,b,m $ $ (1<=a,b,m<=100) $ . The first two integers specify point $ (a,0,b) $ , through which the ceiling and one of the corridor walls pass. The third integer is the distance at which Valera went away from the door. The second line has three space-separated integers $ v_{x},v_{y},v_{z} $ $ (|v_{x}|,|v_{y}|,|v_{z}|<=100,v_{y}&lt;0,v_{z}>=0) $ — the speed of the ball after the hit. It is guaranteed that the ball hits the door.

输出格式


Print two real numbers $ x_{0},z_{0} $ — the $ x $ and $ z $ coordinates of point $ (x_{0},0,z_{0}) $ , at which the ball hits the exit door. The answer will be considered correct, if its absolute or relative error does not exceed $ 10^{-6} $ .

输入输出样例

输入样例 #1

7 2 11
3 -11 2

输出样例 #1

6.5000000000 2.0000000000

输入样例 #2

7 2 11
4 -3 3

输出样例 #2

4.1666666667 1.0000000000

说明

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF203D/0c7708e89f91300ab8f995583354dd8383126f21.png)

Input

加入题单

上一题 下一题 算法标签: