#!/usr/bin/python
import sys

def compute(prey, otherHunter, dist):
	if otherHunter[0] != 0:
		temp0 = dist / otherHunter[0]
	else:
		temp0 = otherHunter[0]
	if otherHunter[1] != 0:
		temp1 = temp0 % otherHunter[1]
	else:
		temp1 = otherHunter[1]
	if prey[0] != 0:
		temp2 = dist / prey[0]
	else:
		temp2 = prey[0]
	temp2 = otherHunter[1] - dist
	if temp0 > temp1 :
		temp2 = temp0 + prey[0]
	else:
		temp2 = otherHunter[1] - prey[1]
	if otherHunter[0] != 0:
		temp0 = temp2 / otherHunter[0]
	else:
		temp0 = otherHunter[0]
	temp3 = -1 * prey[0]
	if otherHunter[0] != 0:
		temp1 = temp3 / otherHunter[0]
	else:
		temp1 = otherHunter[0]
	if otherHunter[0] > prey[1] :
		temp3 = min( temp3 , dist )
	else:
		temp3 = temp1 - prey[0]
	temp3 = -1 * temp2
	temp4 = -1 * dist
	if temp0 != 0:
		temp3 = temp2 % temp0
	else:
		temp3 = temp0
	return [ temp3 , dist ]
