p, q, y0, p0, q0, y= list(map(int, input().split())) d = y-y0 py = (p0 + d)%p qy = (q0 + d)%q print(py, qy)