P, Q, Y0, p0, q0, Y = map(int, input().split()) yp = Y0 % p0 yq = Y0 % q0 px = ((Y - Y0) % P + P+ p0) %P qx = ((Y - Y0) % Q + Q+ q0) %Q print(px, qx)