P, Q, Y0, P0, Q0, Y = map(int,input().split()) a = (P0 + (Y - Y0)) % P b = (Q0 + (Y - Y0)) % Q print(a, b)