PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000097. Tìm hai số có tích chia hết – bản dễ (Divisible Numbers, Easy Version)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tìm hai số có tích chia hết – bản dễ (Divisible Numbers, Easy Version)

Divisible Numbers (easy version)

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given four positive integers a,b,c,da,b,c,d with a<ca<c and b<db<d, find integers x,yx,y such that a<x≤ca<x\le c, b<y≤db<y\le d, and the product xyxy is divisible by abab. Print any valid pair, or -1 -1 if no pair exists.

Input

One line contains a,b,c,da,b,c,d in this order.

Output

Print xx and yy separated by a space, or -1 -1 if no solution exists.

Subtasks

  • Subtask 1 (20 points): 1≤a<c≤401\le a<c\le 40; 1≤b<d≤401\le b<d\le 40.
  • Subtask 2 (30 points): 1≤a<c≤40001\le a<c\le 4000; 1≤b<d≤40001\le b<d\le 4000.
  • Subtask 3 (50 points): 1≤a<c≤1051\le a<c\le 10^5; 1≤b<d≤1051\le b<d\le 10^5.

Examples

Input

3 4 5 7

Output

4 6

Explanation

The pair x=4x=4, y=6y=6 satisfies 3<4≤53<4\le5 and 4<6≤74<6\le7. Moreover xy=24xy=24 is divisible by ab=12ab=12. Thus 4 6 is a valid answer, although other answers may exist.