Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.

Sergey does not like beetles, he loves burgers. Fortunately for him, there are n fast food restaurants on the circle, they are located in the 1-st, the (k + 1)-st, the (2k + 1)-st, and so on, the ((n-1)k + 1)-st cities, i.e. the distance between the neighboring cities with fast food restaurants is k km.

Sergey began his journey at some city s and traveled along the circle, making stops at cities each l km (l > 0), until he stopped in s once again. Sergey then forgot numbers s and l, but he remembers that the distance from the city s to the nearest fast food restaurant was a km, and the distance from the city he stopped at after traveling the first l km from s to the nearest fast food restaurant was b km. Sergey always traveled in the same direction along the circle, but when he calculated distances to the restaurants, he considered both directions.

Now Sergey is interested in two integers. The first integer x is the minimum number of stops (excluding the first) Sergey could have done before returning to s. The second integer y is the maximum number of stops (excluding the first) Sergey could have done before returning to s.

Input

The first line contains two integers n and k (1 ≤ n, k ≤ 100 000) — the number of fast food restaurants on the circle and the distance between the neighboring restaurants, respectively.

The second line contains two integers a and b (0 ≤ a, b ≤ k/2) — the distances to the nearest fast food restaurants from the initial city and from the city Sergey made the first stop at, respectively.

Output

Print the two integers x and y.

Examples

Input


2 3
1 1


Output


1 6


Input


3 2
0 0


Output


1 3


Input


1 10
5 3


Output


5 5

Note

In the first example the restaurants are located in the cities 1 and 4, the initial city s could be 2, 3, 5, or 6. The next city Sergey stopped at could also be at cities 2, 3, 5, 6. Let's loop through all possible combinations of these cities. If both s and the city of the first stop are at the city 2 (for example, l = 6), then Sergey is at s after the first stop already, so x = 1. In other pairs Sergey needs 1, 2, 3, or 6 stops to return to s, so y = 6.

In the second example Sergey was at cities with fast food restaurant both initially and after the first stop, so l is 2, 4, or 6. Thus x = 1, y = 3.

In the third example there is only one restaurant, so the possible locations of s and the first stop are: (6, 8) and (6, 4). For the first option l = 2, for the second l = 8. In both cases Sergey needs x=y=5 stops to go to s.

Difficulty: MEDIUM_HARD
Tags: Mathematics

Complete search
Skill types: Complete search

Starter code:

Solutions:
from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
lll = [a + b, abs(a - b), k - a - b, k - abs(a - b)]
(x, y) = (n * k, 0)
for ll in lll:
	for i in range(n):
		l = ll + i * k
		c = n * k // gcd(l, n * k)
		if c < x:
			x = c
		if c > y:
			y = c
print(x, y)


import os
import sys
from functools import reduce
from io import BytesIO, IOBase
(sys.stdout, stream) = (IOBase(), BytesIO())
sys.stdout.flush = lambda : os.write(1, stream.getvalue()) and (not stream.truncate(0)) and stream.seek(0)
sys.stdout.write = lambda s: stream.write(s.encode())
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
gcdm = lambda *args: reduce(gcd, args, 0)
lcm = lambda a, b: a * b // gcd(a, b)
lcmm = lambda *args: reduce(lcm, args, 1)

def main():
	(n, k) = map(int, input().split())
	(a, b) = map(int, input().split())
	min_l = {(a + b) % k, (a - b) % k, (-a + b) % k, (-a - b) % k}
	res = [10 ** 18, 0]
	for li in min_l:
		while li < n * k:
			x = li if li else n * k
			res = [min(res[0], lcm(x, n * k) // x), max(res[1], lcm(x, n * k) // x)]
			li += k
	print(*res)
main()


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def ways(l):
	return n * k // gcd(n * k, l)

def norm(x):
	if x % (n * k) == 0:
		return n * k
	return x % (n * k)
(n, k) = [int(i) for i in input().split()]
(a, b) = [int(i) for i in input().split()]
start = [norm(1 - a), norm(1 + a)]
ends = []
for i in range(n):
	rest = i * k + 1
	ends.append(norm(rest - b))
	ends.append(norm(rest + b))
lengths = []

def dist(a, b):
	if a <= b:
		return b - a
	else:
		return n * k - a + b
for i in range(len(ends)):
	lengths.append(dist(ends[i], start[0]))
	lengths.append(dist(ends[i], start[1]))
ans = []
for i in lengths:
	ans.append(ways(i))
print(min(ans), max(ans))


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
res = set()
for i in range(100000):
	res.add(n * k // gcd(a + b + k * i, n * k))
	res.add(n * k // gcd(a - b + k * i, n * k))
print(min(res), max(res))


import os
import sys
from io import BytesIO, IOBase
from math import gcd
(sys.stdout, stream) = (IOBase(), BytesIO())
sys.stdout.flush = lambda : os.write(1, stream.getvalue()) and (not stream.truncate(0)) and stream.seek(0)
sys.stdout.write = lambda s: stream.write(s.encode())
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main():
	(n, k) = map(int, input().split())
	(a, b) = map(int, input().split())
	ans = [10 ** 12, 0]
	ls = [(a + b) % k, (a - b) % k, (-a + b) % k, (-a - b) % k]
	for li in ls:
		while li < n * k:
			res = n * k // gcd(n * k, li)
			ans = [min(ans[0], res), max(ans[1], res)]
			li += k
	print(*ans)
main()


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
nk = n * k
cand1 = (gcd(nk, abs(i * k + b - a)) for i in range(n))
cand2 = (gcd(nk, abs(i * k - b - a)) for i in range(n))
cand3 = (gcd(nk, abs(i * k + b + a)) for i in range(n))
cand4 = (gcd(nk, abs(i * k - b + a)) for i in range(n))
ma = max(max(cand1), max(cand2), max(cand3), max(cand4))
cand1 = (gcd(nk, abs(i * k + b - a)) for i in range(n))
cand2 = (gcd(nk, abs(i * k - b - a)) for i in range(n))
cand3 = (gcd(nk, abs(i * k + b + a)) for i in range(n))
cand4 = (gcd(nk, abs(i * k - b + a)) for i in range(n))
mi = min(min(cand1), min(cand2), min(cand3), min(cand4))
print(nk // ma, nk // mi)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
a = a % k
MIN = 10 ** 12
MAX = 0

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
for i in range(n):
	ne = i * k - b
	dist = abs(a - ne)
	if dist == 0:
		dist = n * k
	ANS = n * k // gcd(dist, n * k)
	if ANS < MIN:
		MIN = ANS
	if ANS > MAX:
		MAX = ANS
	ne = i * k + b
	dist = abs(a - ne)
	if dist == 0:
		dist = n * k
	ANS = n * k // gcd(dist, n * k)
	if ANS < MIN:
		MIN = ANS
	if ANS > MAX:
		MAX = ANS
print(MIN, MAX)


def gcd(a, b):
	while b > 0:
		t = a
		a = b
		b = t % b
	return a

def lcm(a, b):
	return a // gcd(a, b) * b
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
x = 1e+18
y = -1e+18
nk = n * k

def upd(l):
	global x, y, nk
	if l > 0:
		t = lcm(nk, l) // l
		x = min(x, t)
		y = max(y, t)
for c in range(0, n + 1):
	upd(c * k + a + b)
	upd(c * k + a - b)
	upd(c * k - a + b)
	upd(c * k - a - b)
print(x, y)


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
(x, y) = (n * k, 1)
for j in range(1, n + 1):
	for kek in (a + b, b - a, a - b, -a - b):
		l = k * j + kek % k
		d = gcd(n * k, l)
		x = min(x, n * k // d)
		y = max(y, n * k // d)
print(x, y)


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
tot = n * k
(mn, mx) = (tot, 0)
for ai in (a, -a):
	for ni in range(n):
		for bi in (b, -b):
			pos1 = ai
			pos2 = k * ni + bi
			if pos1 == pos2:
				x = 1
			else:
				x = tot // gcd(tot, abs(pos1 - pos2))
			mn = min(mn, x)
			mx = max(mx, x)
print(mn, mx)


from math import *
(N, K) = map(int, input().split())
(A, B) = map(int, input().split())
S = [A, K - A]
E = []
for i in range(N):
	if i * K + B >= 0:
		E += [i * K + B]
	if i * K - B >= 0:
		E += [i * K - B]
l = set()
for e in E:
	l.add(abs(e - S[0]))
	l.add(abs(e - S[1]))
(mi, ma) = (None, None)
f = N * K
for i in l:
	rounds = f // gcd(i, f)
	if mi == None:
		mi = rounds
		ma = rounds
	else:
		mi = min(mi, rounds)
		ma = max(ma, rounds)
print(mi, end=' ')
print(ma)


import sys
from math import gcd
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n, k) = I()
(a, b) = I()
if 0:
	print(1, n * k)
else:
	i = abs(a - b)
	j = a + b
	(mi, ma) = (10 ** 12, 0)
	while i <= n * k:
		st = n * k // gcd(i, n * k)
		ma = max(ma, st)
		mi = min(mi, st)
		i += k
		st = n * k // gcd(j, n * k)
		ma = max(ma, st)
		mi = min(mi, st)
		j += k
	print(mi, ma)


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
r = []
i = 1
p = n * k
while i <= n * k:
	r.append(i)
	i += k
s = 1 + a
c = []
for i in r:
	c.append((i - b) % p)
	c.append((i + b) % p)
mx = 0
mn = 1111111111111111111111111
for i in c:
	dp = i - s
	dp %= p
	if not dp:
		ns = 1
	else:
		ns = p // gcd(p, dp)
	mx = max(mx, ns)
	mn = min(mn, ns)
print(mn, mx)


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
(x, y) = (float('inf'), -float('inf'))
m = n * k
for (f, s) in ([1, 1], [-1, -1], [1, -1], [-1, 1]):
	for r in range(2, n + 5):
		val = r * k + b * f + a * s
		dist = m * val // gcd(m, val)
		stops = dist // val
		x = min(x, stops)
		y = max(y, stops)
print(x, y)


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
(x, y) = (int(1000000000000000.0), -1)
for i in range(1, n + 1):
	for v in (a - b, a + b, b - a, -a - b):
		l = k * i + v % k
		g = gcd(n * k, l)
		x = min(x, n * k // g)
		y = max(y, n * k // g)
print(x, y)


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
mn = float('inf')
mx = 0

def process(x):
	global mn, mx
	x %= n * k
	pa = a
	pb = (n * k - a) % (n * k)
	da = (x + n * k - pa) % (n * k)
	db = (x + n * k - pb) % (n * k)
	if da == 0:
		da = n * k
	if db == 0:
		db = n * k
	aa = n * k // gcd(n * k, da)
	ab = n * k // gcd(n * k, db)
	mn = min(mn, aa)
	mn = min(mn, ab)
	mx = max(mx, aa)
	mx = max(mx, ab)
for i in range(n):
	process(i * k + b)
	process((i + 1) * k - b)
print(mn, mx)


def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def my_gcd(fact, mm):
	res = 1
	for i in fact:
		if mm % i == 0:
			mm = mm // i
			res = res * i
	return res

def solve(n, k, a, b):
	qq = [a + b, a - b, -a - b, -a + b]
	mini = n * k
	maxi = 0
	factN = prime_factors(n)
	fact = factN + prime_factors(k)
	m = n * k
	for q in qq:
		for t in range(1, n + 1):
			mm = t * k + q
			if mm > 0:
				x = my_gcd(fact, mm)
				y = m // x
				if y < mini:
					mini = y
				if y > maxi:
					maxi = y
	return (mini, maxi)
(n, k) = input().split()
n = int(n)
k = int(k)
(a, b) = input().split()
a = int(a)
b = int(b)
(x, y) = solve(n, k, a, b)
print(x, y)


import sys
from math import gcd
line = sys.stdin.readline().strip().split()
n = int(line[0])
k = int(line[1])
line = sys.stdin.readline().strip().split()
a = int(line[0])
b = int(line[1])
n1 = n
k1 = k
ans = 1
x = a + b
g1 = gcd(x, k)
k = k // g1
x = x // g1
g2 = gcd(n, k)
while g2 > 1:
	n = n // g2
	ans = ans * g2
	g2 = gcd(n, k)
m1 = ans * k
m2 = ans * k * n
n = n1
k = k1
ans = 1
x = k - a + b
g1 = gcd(x, k)
k = k // g1
x = x // g1
g2 = gcd(n, k)
while g2 > 1:
	n = n // g2
	ans = ans * g2
	g2 = gcd(n, k)
m3 = ans * k
m4 = ans * k * n
print(str(min([m1, m3])) + ' ' + str(max([m2, m4])))


import math

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
factors = primeFactors(n * k)
ls = []
for i in range(n + 1):
	l1 = i * k + a - b
	l1 = abs(l1)
	if l1 > 0:
		ans = 1
		for j in range(len(factors)):
			if l1 > 0 and l1 % factors[j] == 0:
				l1 = l1 // factors[j]
			else:
				ans *= factors[j]
		ls.append(ans)
	l2 = i * k + a + b
	l2 = abs(l2)
	if l2 > 0:
		ans = 1
		for j in range(len(factors)):
			if l2 > 0 and l2 % factors[j] == 0:
				l2 = l2 // factors[j]
			else:
				ans *= factors[j]
		ls.append(ans)
print(min(ls), max(ls))


(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
import math
strips = []

def solve(p1, stripes):
	mini = math.inf
	maxa = 0
	for i in range(len(stripes)):
		l = stripes[i] - p1
		if l == 0:
			mini = 1
			continue
		l += n * k * n
		rounds = n * k // math.gcd(n * k, l)
		mini = min(mini, rounds)
		maxa = max(maxa, rounds)
	return [mini, maxa]
for i in range(n):
	distance = i * k + 1
	strips.append(b + distance)
	distance += k
	strips.append(distance - b)
poss = [a + 1, k - (a - 1)]
mini = math.inf
maxa = 0
for i in range(len(poss)):
	t = solve(poss[i], strips)
	mini = min(mini, t[0])
	maxa = max(maxa, t[1])
print(mini, maxa)


def nod(a, b):
	global n
	global k
	if a < 0:
		a = -a
	if b < 0:
		b = -b
	(a, b) = (max(a, b), min(a, b))
	if b == 0:
		return n * k
	elif a % b == 0:
		return b
	else:
		return nod(b, a % b)
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
minn = n * k
maxx = 0
for i in range(n):
	xx = n * k // nod(k * i + a - b, n * k)
	yy = n * k // nod(k * i + a + b, n * k)
	zz = n * k // nod(k * i - a - b, n * k)
	qq = n * k // nod(k * i - a + b, n * k)
	minn = min(minn, xx, yy, zz, qq)
	maxx = max(maxx, xx, yy, zz, qq)
print(minn, maxx)


from math import gcd

def main():
	(n, k) = map(int, input().split())
	(a, b) = map(int, input().split())

	def dist(x, y):
		if x == y:
			return n * k
		elif y > x:
			return y - x
		return y + n * k - x
	ls = set()
	first = 1 * k
	for i in range(1, n + 1):
		second = i * k
		ls.add(dist(first - a, second - b))
		ls.add(dist(first - a, second + b))
		ls.add(dist(first + a, second - b))
		ls.add(dist(first + a, second + b))
	stops = set()
	for l in ls:
		stops.add(n * k // gcd(n * k, l))
	print(min(stops), max(stops))
main()


from math import gcd as g
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
nk = n * k
res = [float('inf'), -float('inf')]
c = (b - a) % k
for i in range(n):
	l = i * k + c
	x = nk // g(nk, l)
	res[0] = min(res[0], x)
	res[1] = max(res[1], x)
c = (b + a) % k
for i in range(n):
	l = i * k + c
	x = nk // g(nk, l)
	res[0] = min(res[0], x)
	res[1] = max(res[1], x)
print(res[0], res[1])


def readLine():
	a = input()
	return [int(i) for i in a.split(' ')]

def dist(a, b):
	if a <= b:
		return b - a
	return n * m - a + b

def subs(a, b):
	if a - b >= 1:
		return a - b
	return n * m + a - b

def add(a, b):
	if a + b <= n * m:
		return a + b
	return a + b - n * m

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
nk = readLine()
ab = readLine()
(n, m) = (nk[0], nk[1])
(a, b) = (ab[0], ab[1])
x = 1 + a
(ansMin, ansMax) = (n * m, 1)
for i in range(n):
	idx = i * m + 1
	l1 = dist(x, subs(idx, b))
	l2 = dist(x, add(idx, b))
	if l1 == 0:
		l1 = n * m
	if l2 == 0:
		l2 = n * m
	g = gcd(l1, n * m)
	res = n * m // g
	ansMin = min(ansMin, res)
	ansMax = max(ansMax, res)
	g = gcd(l2, n * m)
	res = n * m // g
	ansMin = min(ansMin, res)
	ansMax = max(ansMax, res)
print(ansMin, ansMax)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 1119 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, k) = value()
(a, b) = value()
stops = []
for i in range(n):
	here = i * k
	peeche = (here - b + n * k) % (n * k)
	aage = (here + b + n * k) % (n * k)
	stops.append(peeche)
	stops.append(aage)
mi = inf
ma = -1
for i in stops:
	l = abs(i - a)
	if i > a:
		l = n * k - l
	if l:
		lcm = l * n * k // gcd(l, n * k)
		lcm //= l
	else:
		lcm = 1
	mi = min(mi, lcm)
	ma = max(ma, lcm)
print(mi, ma)


(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
nk = n * k

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
x = 10 ** 18
y = 0
for z in range(1, n + 1):
	d = z * k + a + b
	x = min(x, nk // gcd(nk, d))
	y = max(y, nk // gcd(nk, d))
	d = z * k - a + b
	x = min(x, nk // gcd(nk, d))
	y = max(y, nk // gcd(nk, d))
	d = z * k + a - b
	x = min(x, nk // gcd(nk, d))
	y = max(y, nk // gcd(nk, d))
	d = z * k - a - b
	x = min(x, nk // gcd(nk, d))
	y = max(y, nk // gcd(nk, d))
print(*(x, y))


from math import gcd

def main():
	(n, k) = map(int, input().split(' '))
	(a, b) = map(int, input().split(' '))
	l = [abs((-1) ** c1 * a + (-1) ** c2 * b) for (c1, c2) in zip([0, 0, 1, 1], [0, 1, 0, 1])]
	gmin = 1061109567
	gmax = 0
	for m in range(1, n + 1):
		gs = [gcd(n * k, m * k + lx) for lx in l]
		gmin = min(gmin, *gs)
		gmax = max(gmax, *gs)
	print(n * k // gmax, n * k // gmin)
exit(main())


import math
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
mx = -1e+18
mn = 1e+18
for i in range(0, n):
	x1 = math.gcd(n * k, i * k + k - a + b)
	x2 = math.gcd(n * k, i * k + k - a - b)
	x3 = math.gcd(n * k, i * k + k + a - b)
	x4 = math.gcd(n * k, i * k + k + a + b)
	mx = max(mx, max(x1, max(x2, max(x3, x4))))
	mn = min(mn, min(x1, min(x2, min(x3, x4))))
print(str(n * k // mx) + ' ' + str(n * k // mn))


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
l = [b - a, -a - b]
g = []
for i in range(n):
	for j in range(2):
		u = k * i + l[j]
		m1 = gcd(u, n * k)
		g.append(m1)
max1 = min(g)
max2 = n * k // max1
min1 = max(g)
min2 = n * k // min1
if a == b:
	min2 = 1
if a == 0 and b == 0:
	max2 = n
print(min2, max2)


from collections import defaultdict as dd
import math

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
(n, k) = mi()
(d1, d2) = mi()
distances = []
for i in range(n):
	distances.extend([i * k + abs(d1 - d2), i * k + abs(d1 + d2)])
gcds = []
for d in distances:
	gcds.append(math.gcd(d, n * k))
print(n * k // max(gcds), n * k // min(gcds))


(n, k) = list(map(int, input().split()))
(a, b) = list(map(int, input().split()))

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mi = n * k
ma = 0
s1 = 1 + a
start = k + 1 - b
for i in range(start, n * k + 1, k):
	l1 = i - s1
	if l1 < 0:
		break
	else:
		x = n * k // gcd(n * k, l1)
		mi = min(mi, x)
		ma = max(ma, x)
start = 1 + b
for i in range(start, n * k + 1, k):
	l1 = i - s1
	if l1 < 0:
		break
	else:
		x = n * k // gcd(n * k, l1)
		mi = min(mi, x)
		ma = max(ma, x)
s2 = k + 1 - a
start = k + 1 - b
for i in range(start, n * k + 1, k):
	l1 = i - s2
	if l1 < 0:
		break
	else:
		x = n * k // gcd(n * k, l1)
		mi = min(mi, x)
		ma = max(ma, x)
start = 1 + b
for i in range(start, n * k + 1, k):
	l1 = i - s2
	if l1 < 0:
		break
	else:
		x = n * k // gcd(n * k, l1)
		mi = min(mi, x)
		ma = max(ma, x)
print(mi, ma)


import math
oo = 200000000000
mn = oo
mx = -oo

def main():
	(n, k) = map(int, input().split())
	(s, l) = map(int, input().split())
	length = n * k

	def solve(s):
		global mn, mx
		for i in range(n):
			for j in [1, -1]:
				pnt = (i * k + l * j + length) % length
				dist = (s - pnt + length) % length
				mn = min(mn, length // math.gcd(length, dist))
				mx = max(mx, length // math.gcd(length, dist))
	solve(s)
	solve((k - s + length) % length)
	print(mn, mx)
	pass
main()


from math import gcd
(n, k) = map(int, input().split())
(a, b) = map(int, input().split())
nk = n * k
cand = []
for i in range(n):
	cand.append(gcd(nk, abs(i * k + b - a)))
	cand.append(gcd(nk, abs(i * k - b - a)))
	cand.append(gcd(nk, abs(i * k + b + a)))
	cand.append(gcd(nk, abs(i * k - b + a)))
print(nk // max(cand), nk // min(cand))