A rectangular grid area is w wide and h tall. Its lower left corner is (0,0) and its upper right corner is (w,h). One ant sits at the point (p,q) inside this area.
The ant starts moving at a constant speed in the up-right 45 degree direction. After one hour the ant that started at (p,q) has moved to (p+1,q+1). When it hits a boundary while moving at that speed, it reflects and keeps the same speed.

The picture above shows the path of an ant that starts at (4,1) on a 6×4 grid. That ant is at (6,3) after 2 hours and at (0,1) after 8 hours. If the ant had started at (5,3) on the same grid, it would move to (6,4), (5,3), (4,2), (3,1) hour by hour.
Compute and print the position (x,y) of the ant t hours after it starts at (p,q) on a grid of size w×h. Assume the ant never tires and keeps the same speed.
w and h are natural numbers with 2≤w,h≤40000. The starting coordinates p and q are natural numbers with 0<p<w and 0<q<h. The time t satisfies 1≤t≤200000000.
The first line contains w and h separated by a space. The second line contains the starting coordinates p and q separated by a space. The third line contains the time t the ant moves.
Print x and y of the ant position (x,y) after t hours, separated by a space, on one line.