Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through $$$n \cdot k$$$ cities. The cities are numerated from $$$1$$$ to $$$n \cdot 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$$$.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 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 \le a, b \le \frac{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.

Print the two integers $$$x$$$ and $$$y$$$.

NoteIn 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$$$.

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
    ll n,k,a,b;
    cin>>n>>k>>a>>b;
    ll t[4]={a+b,a-b,-a+b,-a-b};
    ll p=n*k;
    ll mx=-1,mn=1e18;
    for(int i=0;i<4;i++)
    {
        ll s=t[i];
        for(int j=0;j<n;j++,s+=k)
        {
            mx=max(mx,p/(abs(__gcd(p,s))));
            mn=min(mn,p/(abs(__gcd(p,s))));
        }
    }
    cout<<mn<<" "<<mx<<endl;
    return 0;
}

#include <iostream>
#include <cmath>

long long gcd(long long a, long long b) {

	while (a > 0 && b > 0) {
		if (a > b) {
			a = a % b;
		}
		else {
			b = b % a;
		}
	}

	return a + b;
}

long long lcm(long long a, long long b) {
	return (a / gcd(a, b)) * b;
}

int main()
{
	long long n, k;
	long long a, b;
	std::cin >> n >> k;
	std::cin >> a >> b;

	//variant1: a+b

	long long t = std::ceil((a + b) / k);
	long long l1 = t * k - a - b;
	if (l1 <= 0) l1 += k;

	//variant2: a-b

	t = std::ceil((a - b) / k);
	long long l2 = t * k - a + b;
	if (l2 <= 0) l2 += k;

	//variant3: -a+b

	t = std::ceil((b - a) / k);
	long long l3 = t * k + a - b;
	if (l3 <= 0) l3 += k;

	//variant4: -a-b

	t = std::ceil((-a - b) / k);
	long long l4 = t * k + a + b;
	if (l4 <= 0) l4 += k;

	long long x = 0;
	long long y = 0;

	for (int i = 0; i < n; ++i) {
		long long L1 = (n * k) / gcd(n*k, l1);
		long long L2 = (n * k) / gcd(n*k, l2);
		long long L3 = (n * k) / gcd(n*k, l3);
		long long L4 = (n * k) / gcd(n*k, l4);

		if (y < L1) y = L1;
		if (y < L2) y = L2;
		if (y < L3) y = L3;
		if (y < L4) y = L4;

		if (x == 0) x = L1;
		if (x == 0) x = L2;
		if (x == 0) x = L3;
		if (x == 0) x = L4;
		if (x > L1) x = L1;
		if (x > L2) x = L2;
		if (x > L3) x = L3;
		if (x > L4) x = L4;

		l1 += k;
		l2 += k;
		l3 += k;
		l4 += k;
	}

	std::cout << x << " " << y <<std::endl;

	return 0;
}

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<time.h>
#define ll long long
#define U unsigned
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(x,m,n) for(int x=m;x<=n;x++)
#define All(x)  (x.begin(),x.end())
#define ls rt<<1
#define rs rt<<1|1
#define lson l,m,ls
#define rson m+1,r,rs
#define pb push_back
#define mp make_pair
#define print(x) cout<<(x)
#define pin cout<<'\n'
#define sp cout<<" "
#define println(x) cout<<(x)<<'\n'
#define read(x) cin>>(x)
#define debug cout<<"test"
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
const ll INF=0x3f3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const int N=2e5+5;
ll n;
//int a[N];
vector<int> e[N];
int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
  ll k;
void INIT()
{
    //fill

//    rep(i,1,n)
//    {
//        e[i].clear();
//    }
}
ll maxx,minn;
void check(ll x,ll y)
{

    ll l=(y-x);
    if(l<0) l+=n*k;
    ll s=(n*k)/__gcd(n*k,l);
    minn=min(s,minn);
    maxx=max(s,maxx);
}
void solve()
{
    INIT();

    ll a,b;
    cin>>k>>a>>b;
    maxx=0;
    minn=INF;
    for(int i=0; i<n; i++)
    {
         check(a,i*k-b);
         check(a,i*k+b);
         check(-a,i*k-b);
         check(-a,i*k+b);
    }
    cout<<minn<<" "<<maxx<<endl;
}
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n)
    {
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n, k, a, b, min = 1e10, max = 0;
	cin >> n >> k >> a >> b;
	long long prod = n*k;
	for (int i = 0; i <= n; i++){
		 long long la = i*k + b - a, lb = i*k - b - a, ans;
		 ans = prod/__gcd(prod, la);
		 if (la > 0 && min > ans) min = ans;
		 if (la > 0 && max < ans) max = ans;
		  ans = prod/__gcd(prod, lb);
		 if (lb > 0 && min > ans) min = ans;
		 if (lb > 0 && max < ans) max = ans;
	}
	cout << min << " " << max;
}

#include <iostream>
using namespace std;

typedef long long Long;

Long GCD(Long, Long);

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	Long N, K, a, b, x = 0x7FFFFFFFFFFFFFFF, y = 0, S, L, Temp;
	Long C[4];
	cin >> N >> K >> a >> b;
	S = N*K;
	C[0] = (a+b)%K;
	C[1] = (a-b)%K;
	C[2] = (b-a)%K;
	C[3] = (-a-b)%K;
	for(long i=0; i<N; ++i)
		for(long j=0; j<4; ++j)
		{
			L = i*K + C[j];
			if(L<0) continue;
			x = min(x, S/GCD(S, L));
			y = max(y, S/GCD(S, L));
		}

	cout << x << ' ' << y;
	return 0;
}

Long GCD(Long X, Long Y)
{
	while(X>0 && Y>0)
		if(X>Y)
			X %= Y;
		else
			Y %= X;
	return X+Y;
}

#include <bits/stdc++.h>

using namespace std;

#define SZ(x) ((int)(x).size())
#define PB(x) push_back(x)
#define MEMSET(x,v) memset(x,v,sizeof(x))
#define REP(i,n) for(int i=0;(i)<(n);++(i))
#define x first
#define y second
#define INF (0x3f3f3f3f)

typedef long long LL;
typedef pair<int, int> P2;
template<class A, class B> inline bool mina(A &x, B y) {return (x > y)?(x=y,1):0;}
template<class A, class B> inline bool maxa(A &x, B y) {return (x < y)?(x=y,1):0;}

LL N, K;
LL A, B;
LL ans_max, ans_min;

void solve2(LL start, LL first_stop) {
    LL l;
    if (start == first_stop) {
        l = N * K;
    } else {
        l = first_stop - start + N * K;
        l %= N * K;
    }
    LL x = N * K / gcd(N * K, l);
    mina(ans_min, x);
    maxa(ans_max, x);
}

int main() {
    ans_min = (1LL<<62);
    ans_max = 0;
    cin >> N >> K;
    cin >> A >> B;
    for (auto start : {A, N * K - A}) {
        start %= N * K;
        REP(i, N) {
            for (auto first_stop : {K * i + B, K * i - B}) {
                solve2(start, (first_stop + N * K) % (N * K));
            }
        }
    }
    cout << ans_min << " " << ans_max;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

typedef long long LL;

LL n,k,a,b,mx,mn;

LL gcd(LL x,LL y)
{
	if (!y) return x;
	else return gcd(y,x%y);
}

void solve(LL w)
{
	LL d=gcd(w,k),x=w/d,y=k/d;
	for (int i=0;i<n;i++)
	{
		LL p=gcd((x+(LL)y*i)%n,n);
		mx=std::max(mx,y*n/p);
		mn=std::min(mn,y*n/p);
	}
}

int main()
{
	scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
	mn=n*k;mx=0;
	int x1=a,x2=k-a,y1=b,y2=k-b;
	solve(abs(x1-y1));
	solve(abs(x1-y2));
	solve(abs(x2-y1));
	solve(abs(x2-y2));
	printf("%lld %lld\n",mn,mx);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define ff first
#define ss second

int main() {
	int t =1;
	// scanf("%d", &t);
	while (t--) {
		ll n, k;
		cin>>n>>k;
		ll x, y;
		cin>>x>>y;
		ll mn = n*k+1;
		ll mx = -1;
		ll in = 1+x;
		for (ll i=0; i<n; i++) {
			ll t = i*k+1;
			ll a = abs(t+y-in);
			ll b = abs(t-y-in);

			if (a==(ll)0) {
				mn = 1;
				mx = max(mx, (ll)1);
			} else {
				ll g = __gcd(a, n*k);
				ll d = n*k/(g);
				// cout << "d = " << d << endl;
				mn = min(mn, d);
				mx = max(mx, d);
			}
			if (b==(ll)0) {
				mn = 1;
				mx = max(mx, (ll)1);
			} else {
				ll g = __gcd(b, n*k);
				ll d = n*k/(g);
				// cout << "d = " << d << endl;
				mn = min(mn, d);
				mx = max(mx, d);
			}
			// cout << "i = " << i << " a = " << a << " b = " << b << " mn = " << mn << " mx = " << mx << endl;
		}
		cout << mn << " " << mx << endl;
	}
}

#include <bits/stdc++.h>
#define Pb push_back
using namespace std;
typedef long long ll;
typedef double db;
inline int R() { int rt; scanf ( "%d", &rt ); return rt; }
ll Gcd ( ll a, ll b ) { return b ? Gcd ( b, a % b ) : a; }
ll mx, mn, s, n, k;

void Gao ( ll a, ll b )
{
	ll l = 0;
	for ( ; ( a + l ) % k != b % k; ++l );
	for ( ; l <= s; l += k )
		mx = max ( mx, s / Gcd ( s, l ) ), mn = min ( mn, s / Gcd ( s, l ) );
}

int main()
{
//	freopen ( "test.in", "r", stdin );
	n = R(), k = R();
	ll a = R(), b = R();
	mn = 1ll * n * k, mx = 1, s = 1ll * n * k;
	Gao ( a, b ), Gao ( k - a, b ), Gao ( a, k - b ), Gao ( k - a, k - b );
	cout << mn << " " << mx << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define maxn 100002
#define mod 1000000007

ll n,k,a,b,mx;
ll x,y;

void update(ll m, ll pos){
    ll d=abs(m-pos);
    ll step=mx/__gcd(mx,d);
    x=min(x,step),y=max(y,step);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(),cout.tie();
    cin>>n>>k;
    cin>>a>>b;
    x=1e18,y=0;
    mx=n*k;
    if(mx==1){
        cout<<0<<" "<<0<<endl;
        return 0;
    }
    ll pos1=1+a,pos2=k-a+1;
    ll m=k-b+1;
    for(ll i=1,j=m;i<=n;i++,j+=k){
        ll pos=j%mx;
        if(pos==0) pos=mx;
        update(pos,pos1), update(pos,pos2);
    }
    m=1+b;
    for(ll i=1,j=m;i<=n;i++,j+=k){
        ll pos=j%mx;
        if(pos==0) pos=mx;
        update(pos,pos1), update(pos,pos2);
    }
    cout<<x<<" "<<y<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#ifdef Adrian
#include "debug.h"
#else
#define debug(...) 9999
#endif

typedef long long ll;
typedef long double ld;
//typedef complex<ld> point;
#define F first
#define S second
#define ii pair<ll,ll>
template<typename G1, typename G2 = G1, typename G3 = G1>
struct triple{ G1 F; G2 S; G3 T;};
typedef triple<int> iii;

int main() {
#ifdef Adrian
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif

    ll n, k;
    cin>>n>>k;
    ll a, b;
    cin>>a>>b;

    ll mx = 0, mn = 1e18;
    auto solve = [&](ll x, ll y)
    {
        ll l = y - x;
        if(l <= 0) l += k;

        for(ll i=0; i<n; i++)
        {
            ll p = l + i * k;
            ll t = n * k / __gcd(n * k, p);
            mx = max(mx, t);
            mn = min(mn, t);
        }
    };

    solve(a, b);
    if(a) solve(k - a, b);
    if(b) solve(a, k - b);
    if(a > 0 && b > 0) solve(k - a, k - b);

    cout<<mn<<" "<<mx<<'\n';

    return 0;
}

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
ll ans1=1,ans2=1e10;
ll n,k;
void check(ll x)
{
    for(int i=0;i<=n;i++)
    {
        ll l=i*k+x;
        if(l>0)ans1=max(ans1,n*k/__gcd(n*k%l,l)),ans2=min(ans2,n*k/__gcd(n*k%l,l));
    }
}
int main()
{

    scanf("%lld%lld",&n,&k);
    ll a,b;
    scanf("%lld%lld",&a,&b);
    ans1=1,ans2=1e10;
    ll x;
    x=-a-b,check(x);
    x=a+b,check(x);
    x=a-b,check(x);
    x=b-a,check(x);
    printf("%lld %lld\n",ans2,ans1);
}

#include<bits/stdc++.h>

using namespace std;

long long int gcd(long long int a, long long int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

// Function to return LCM of two numbers

int main()
{
    long long int n,k,a,b,d,l1,l2,l3,l4,mx=LLONG_MIN,mn=LLONG_MAX,i,v1,v2,x,s;
    vector<long long int> l;
    map<long long int,long long int> m;
   cin>>n>>k;
   cin>>a>>b;
   d=n*k;
   s=1+a;

  /* l1=a+b;
   l2=d-l1;
   l3=abs(b-a);
   l4=d-l3;*/

   for(i=1;i<=d;i=i+k)
   {
       //cout<<546<<endl;
       v1=(i-b)>0?i-b:i-b+d;
       v2=i+b;
       l1=abs(s-v1);
       l2=abs(d-l1);
       l3=abs(s-v2);
       l4=abs(d-l3);

       //cout<<l1<<" "<<l2<<" "<<l3<<" "<<l4<<endl;
       if(!m[l1] && l1!=0)
        {l.push_back(l1);m[l1]=1;}

       if(!m[l2] && l2!=0)
        {l.push_back(l2);m[l2]=1;}

        if(!m[l3] && l3!=0)
        {l.push_back(l3);m[l3]=1;}

        if(!m[l4] && l4!=0)
        {l.push_back(l4);m[l4]=1;}
   }

   //cout<<546<<endl;
   for(i=0;i<l.size();i++)
   {
       x=d/(gcd(d,l[i]));

       //cout<<546<<endl;

       if(x>mx)
        mx=x;

       if(x<mn)
        mn=x;
   }

   cout<<mn<<" "<<mx;

    return 0;
}

#include <bits/stdc++.h>
#define int long long int
#include <iomanip>
using namespace std;
int gcd(int a , int b ){
    if(a==0){
        return b;
    }
    return gcd(b%a , a );
}
signed main(){
    ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	int n , k;
	cin>>n>>k;
	int a , b;
	cin>>a>>b;
	int mini = n*k;
	int maxi = 0;
	for(int x = 0;x<=n;x++){
        int y1 = a+b+k*x;
        int y2 = k-a+b+k*x;
        int y3 = k-a+k-b+k*x;
        int y4 = a+ k-b+k*x;
        if(y1>0 ){
            int w = (n*k)/(gcd(n*k , y1 ) );
            mini = min(mini ,w  );
            maxi = max(maxi , w );
        }
        if(y2>0 ){
            int w = (n*k)/(gcd(n*k , y2 ) );
            mini = min(mini ,w  );
            maxi = max(maxi , w );
        }if(y3>0){
            int w = (n*k)/(gcd(n*k , y3 ) );
            mini = min(mini ,w  );
            maxi = max(maxi , w );
        }if(y4>0 ){
            int w = (n*k)/(gcd(n*k , y4 ) );
            mini = min(mini ,w  );
            maxi = max(maxi , w );
        }
	}
	cout<<mini<<" "<<maxi;
}

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
#define mod 1000000007
#define mod2 998244353
#define double long double
#define pb push_back
#define swap(x,y) (x^=y^=x^=y)
#define TC int TESTCASE;cin>>TESTCASE;while(TESTCASE--)
#define oo 1500000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;
using namespace std;

bool isPrime(int n){
    if(n < 2)return 0;
    if(n < 4)return 1;
    if(n % 2 == 0 or n % 3 == 0)return 0;
    for(int i = 5; i*i <= n; i += 6)if(n % i == 0 or n % (i+2) == 0)return 0;
    return 1;
}

int modexpo(int x,int p){
    int res = 1;x = x%mod;
    while(p){
        if(p%2)res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}

int max(int a,int b){return (a>b?a:b);}

int min(int a,int b){return (a<b?a:b);}

struct edge{int u,v,w;edge(int a,int b,int c){u=a;v=b;w=c;}};

struct compare{
    bool operator() (const pair<int,int> a, const pair<int,int> b) const{
        return a.first > b.first;
    }
};

int32_t main(){
    IOS
    int n,k;
    cin >> n >> k;
    int a,b;
    cin >> a >> b;
    int tot = n*k;
    int ans1 = 0, ans2 = 1e18;
    int cur = 0;
    int x = abs(a-b);
    int y = abs(a+b-k);
    while(x <= tot && y <= tot){
        ans1 = max(ans1,max(__gcd(x,tot),__gcd(y,tot)));
        ans2 = min(ans2,min(__gcd(x,tot),__gcd(y,tot)));
        x += k;
        y += k;
    }
    cout<<tot/ans1<<" "<<tot/ans2<<endl;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    int n,k; cin>>n>>k;
    int a,b; cin>>a>>b;
    int x=1e18;
    int y=0;
    int mod=n*k;
    for(int i=0;i<n;i++)
    {
        int c=(a+b)+i*k;  //cout<<c<<"  ";
        int f=__gcd(c%mod,n*k);
        if(f==0) {x=1; }
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
        c=k-a+b+i*k;     // cout<<c<<"  ";
        f=__gcd(c%mod,n*k);
         if(f==0) {x=1; }
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
        c=k-b+a+i*k;     // cout<<c<<"  ";
        f=__gcd(c%mod,n*k);
         if(f==0) {x=1; }
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
        c=k-b+k-a+i*k;   // cout<<c<<"  "; cout<<endl;
        f=__gcd(c%mod,n*k);
         if(f==0) {x=1; }
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
    }
    cout<<x<<" "<<y<<endl;
}

#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

ll gcd(ll n, ll m)
{
    return m==0 ? n: gcd(m, n%m);
}

int main()
{
    ll n, k, a, b;
    scanf("%lld %lld %lld %lld", &n, &k, &a, &b);

    ll maxs, mins;
    maxs = 0;
    mins = n*k;
    rep(f, 0, 2)
        rep(g, 0, 2)
            rep(i, 0, n+1)
            {
                ll x = (f==1)? a: k-a;
                ll y = (g==1)? b: k-b;

                ll l = abs(y - x + i*k);
                ll now = n * k /gcd(n*k, l);

                /* printf("l: %lld, now: %lld", l, now); */

                //update
                maxs = max(maxs, now);
                mins = min(mins, now);
            }
    cout << mins << ' ' << maxs << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  int64_t n, k;
  cin >> n >> k;
  int64_t a, b;
  cin >> a >> b;
  vector<int64_t> vs;
  int64_t total_length = static_cast<int64_t>(n) * k;
  vs.push_back(total_length - b);
  vs.push_back(b);
  for (int64_t i = 1; i < n; ++i) {
    vs.push_back(static_cast<int64_t>(i) * k - b);
    vs.push_back(static_cast<int64_t>(i) * k + b);
  }
  int64_t max_stops = numeric_limits<int64_t>::min();
  int64_t min_stops = numeric_limits<int64_t>::max();
  for (int64_t v : vs) {
    int64_t l = (v >= a ? v - a : total_length + v - a);
    int64_t num_stops = (l == 0 ? 1 : total_length / gcd(l, total_length));
    // cout << l << ' ' << num_stops << endl;
    max_stops = max(max_stops, num_stops);
    min_stops = min(min_stops, num_stops);
  }
  cout << min_stops << ' ' << max_stops;
}

#include<iostream>
#include<vector>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <cctype>
#include <stack>
#include <list>
#include <queue>
#include <map>
#include <sstream>
#include <cmath>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>

//DOUBLE D UP
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define N 300005
#define pb push_back
#define F first
#define S second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define piii pair<pi,pi>
#define M 1000000007ll
#define ld long double
#define inf (ll)1000000007ll
using namespace std;

ll x[2],y[2],n,k;
ll f(ll a, ll l,ll k)
{
    if(l==0)
        l=k;
    ll z=n*k;
    // for(ll i=2;i<N;i++)
    // {
    //     while(z%i==0 && l%i==0)
    //     {
    //         z/=i;
    //         l/=i;
    //     }
    // }
    return z/(__gcd(l,z));
}
/*
(a+r*l)%k = a
a+r*l = z*k+a

r*l = z*k*/
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output2.txt","w",stdout);
    #endif
    fast
    ll a,b,i,ans1=N*1LL*N*1LL*N,ans2=0,j;

    cin>>n>>k;
    cin>>a>>b;
   x[0] = a;
   x[1] = k-a;
   y[0] = b;
   y[1] = k-b;
   //5
   for(i=0;i<2;i++)
    for(j=0;j<2;j++)
    {
        for(int r=0;r<=(n+1);r++){
            ll l = (y[j]-x[i]+k)%k + (r*k);
        if((x[i]+l)%k != b && (x[i]+l)%k !=(k-b))
            continue;
            ll z1= f(x[i],(y[j]-x[i]+k)%k + (r*k), k);
       ans1 = min(ans1, z1);
       ans2 = max(ans2, z1);
        }

     //   z1= f(x[i],((y[j]-x[i]+k)%k) + (n*k), k);
     //   ans1 = min(ans1, z1);
     //   ans2 = max(ans2, z1);
     // //  else
     //   z1= f(x[i],((y[j]-x[i]+k)%k) + ((n+1)*k), k);
     //   ans1 = min(ans1, z1);
     //   ans2 = max(ans2, z1);

     //   z1 = f(x[i],((y[j]-x[i]+k)%k) + k, k);
     //   ans1 = min(ans1, z1);
     //   ans2 = max(ans2, z1);
       //if(z==10)
      //  cout<<x[i]<<" "<<y[j]<<" "<<(y[j]-x[i]+k)%k<<endl;

    }
   cout<<ans1<<" "<<ans2<<"\n";
}

#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <cmath>
#include <unordered_map>
#include <queue>
#include <map>
#include <functional>
#include <stack>
#include <cmath>
#include <cstring>
#include <random>
#include <chrono>
#include <memory>
#include <cassert>
#include <numeric>
#define int long long
#define pii pair<int, int>
#define x first
#define y second
#define ll long long
#define endl "\n"
#pragma GCC optimize ("O3")

using namespace std;

const int N = 1e6 + 10;
const int inf = 1e18;
const int mod = 1e9 + 7;
const int eps = 1e-9;
const char spc = 29;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

using namespace std;

int n, k;
int a, b;

int __gcd(int a, int b)
{
	if (a < b)
		swap(a, b);

	if (b == 0)
		return a;

	return __gcd(b, a % b);
}

bool check(int l)
{
	if (min((k - ((a + l) % k)) % k, (a + l) % k) == b)
		return true;

	return false;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	cin >> n >> k >> a >> b;

	int s = a;
	int ansmn = inf;
	int ansmx = -inf;

	int l1 = k - a - b;
	int l2 = abs(a - b);

	for (int i = 0; i <= n + 10; ++i)
	{
		ansmn = min(ansmn, n * k / __gcd(n * k, l1));
		ansmx = max(ansmx, n * k / __gcd(n * k, l1));
		ansmn = min(ansmn, n * k / __gcd(n * k, l2));
		ansmx = max(ansmx, n * k / __gcd(n * k, l2));

		l1 += k;
		l2 += k;
	}

	cout << ansmn << " " << ansmx << endl;
}

//May the force be with me
#include "bits/stdc++.h"
#define f first
#define s second
#define inf 1e18
#define ll long long
#define mod 1000000007
#define pb push_back
#define vll vector<long long int>
#define ull unsigned long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) ((long long int)(x).size())
#define mll map<long long int, long long int>
#define pll pair<long long int, long long int>
#define endl "\n"
using namespace std;

void solve(){
	ll n, k, a, b;
	cin >> n >> k >> a >> b;
	pll c;
	vll d;
	//0
	c.f = a;
	c.s = b;
	for(; c.s < n*k; c.s+=k) d.pb(abs(c.s - c.f));
	//1
	c.f = k-a;
	c.s = k-b;
	for(; c.s < n*k; c.s+=k) d.pb(abs(c.s - c.f));
	//2
	c.f = k-a;
	c.s = b;
	for(; c.s < n*k; c.s+=k) d.pb(abs(c.s - c.f));
	//3
	c.f = a;
	c.s = k-b;
	for(; c.s < n*k; c.s+=k) d.pb(abs(c.s - c.f));
	ll ans1 = n*k, ans2 = 1;
	if(a==b)ans1 = 1;
	for(ll i = 0; i < sz(d); i++){
		if(d[i] <= 0)continue;
		ans1 = min(ans1, n*k/__gcd(n*k, d[i]));
		ans2 = max(ans2, n*k/__gcd(n*k, d[i]));
	}
	cout << ans1 << " " << ans2;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(20);
	ll t = 1;
	//cin >> t;
	while(t--){
		solve();
		cout << endl;
	}
	cin.get();
	return 0;
}
//g++ -Wshadow -Wall -O2 -Wno-unused-result -Wno-psabi

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define gcd __gcd

int main(){
    ll n, k, a, b, x = LLONG_MAX, y = LLONG_MIN;
    cin >> n >> k >> a >> b;
    for(int i = 0; i < n; i++){
        x = min(x, n*k/gcd(n*k, k -a +b +i*k));
        x = min(x, n*k/gcd(n*k, k -a -b +i*k));
        x = min(x, n*k/gcd(n*k, a +b +i*k));
        x = min(x, n*k/gcd(n*k, (k +a -b +i*k)%(n*k)));

        y = max(y, n*k/gcd(n*k, k -a +b +i*k));
        y = max(y, n*k/gcd(n*k, k -a -b +i*k));
        y = max(y, n*k/gcd(n*k, a +b +i*k));
        y = max(y, n*k/gcd(n*k, (k +a -b +i*k)%(n*k)));
    }
    cout<< x << " " << y << "\n";
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,k,a,b;
ll gcd(ll a,ll b)
{
	if(!b)return a;
	return gcd(b,a%b);
}
int main()
{
	cin>>n>>k>>a>>b;
	ll x=n*k,y=0;
	for(int i=1;i<=n;++i)
	{
		x=min(x,n*k/gcd(a+b+k*i,n*k));
		y=max(y,n*k/gcd(a+b+k*i,n*k));
		x=min(x,n*k/gcd(a-b+k*i,n*k));
		y=max(y,n*k/gcd(a-b+k*i,n*k));
		x=min(x,n*k/gcd(b-a+k*i,n*k));
		y=max(y,n*k/gcd(b-a+k*i,n*k));
		x=min(x,n*k/gcd(k-a-b+k*i,n*k));
		y=max(y,n*k/gcd(k-a-b+k*i,n*k));
	}
	cout<<x<<" "<<y<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define fore(i,ii,iii) for(ll i=ii;i<iii;i++)

ll n,m,k,a,b;

int main() {
  ios::sync_with_stdio(false);
  cin>>n>>k>>a>>b;
	vector<ll>mul={k+a+b,k+a-b,k-a+b,k-a-b};
	fore(i,0,4)if(mul[i]==0)mul[i]=k;
	ll mn=1e18,mx=0;
	for(ll i:mul){
		fore(j,1,n+1) {
			mn=min(mn,__gcd(n*k,k*j+i));
			mx=max(mx,__gcd(n*k,k*j+i));
		}
	}
	cout<<(n*k)/mx<<" "<<(n*k)/mn<<endl;
}

#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

#define REP(i,b) for(int i=0;i<(b);i++)
#define PER(i,a,b) for(int i=(a);i>(b);i++)
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(s) memset(s, 0, sizeof(s))
#define IN(t, x) (t.find(x) != t.end())
#define PB push_back
#define MP make_pair
#define VI vector<int>

typedef vector<pair<int, int>> VPII;
typedef pair<int, int> PII;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = (int) 1e9 + 7;
string ascii_lowercase = "abcdefghijklmnopqrstuvwxyz";
string ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

long long inv(long long a, long long b) {
    return 1 < a ? b - inv(b % a, a) * b / a : 1;
}

const ll INF = 1e6;

unordered_map<int, int, custom_hash> mp;
// unordered_map<int, unordered_map<int, int, custom_hash>, custom_hash> g;

ll gcd(ll a, ll b, ll &x, ll &y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

ll distsq(ll x1, ll y1, ll x2, ll y2) {
    return (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
}

ll n, m, k;
ll a, b;

int main() {
    // freopen("in.txt", "r", stdin);
    cin >> n >> k;
    cin >> a >> b;
    ll least = n * k;
    ll most = 1;
    ll x;
    ll step;
    ll d;
    ll lcm;
    for (ll i = 0; i < n; i++) {
        // qk + b
        step = (i+1) * k + b - a;
        if (step <= 0) step += n * k;
        d = __gcd(n*k, step);
        lcm = (n*k/ d) * step;
        m = lcm / step;
        least = min(least, m);
        most = max(most, m);

        // qk - b
        step = (i+1) * k - a - b;
        if (step <= 0) step += n * k;
        d = __gcd(n*k, step);
        lcm = (n*k/ d) * step;
        m = lcm / step;
        least = min(least, m);
        most = max(most, m);
    }
    printf("%lld %lld\n", least, most);

    return 0;
}

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long LL;
LL n,k;
LL nn;
LL a,b;
LL calc (LL l,LL r)	{if (l==r) return nn;return (r-l+nn)%nn;}
LL gcd (LL x,LL y)	{return x==0?y:gcd(y%x,x);}
LL calc1 (LL x,LL y)
{
	//printf("%lld %lld\n",x,y);
	LL t=gcd(x,y);
	return y/t;
}
int main()
{
	scanf("%lld%lld",&n,&k);nn=n*k;
	scanf("%lld%lld",&a,&b);
	LL x=a+1,y=k-a+1;
	LL ans1=nn,ans2=0;
	for (LL u=1;u<=n;u++)
	{
		LL t=(u-1)*k+b+1,t1=(u-1)*k+k-b+1;
		LL l=calc(x,t1);
		if (l!=0)
		{
			ans1=min(ans1,calc1(l,nn));
			ans2=max(ans2,calc1(l,nn));
		}
		l=calc(x,t);
		if (l!=0)
		{
			ans1=min(ans1,calc1(l,nn));
			ans2=max(ans2,calc1(l,nn));
		}
		l=calc(y,t);
		if (l!=0)
		{
			ans1=min(ans1,calc1(l,nn));
			ans2=max(ans2,calc1(l,nn));
		}
		l=calc(y,t1);
		if (l!=0)
		{
			ans1=min(ans1,calc1(l,nn));
			ans2=max(ans2,calc1(l,nn));
		}
	}
	printf("%lld %lld\n",ans1,ans2);
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, k, a, b, tmp;

int main() {
	cin >> n >> k >> a >> b;
	ll sum = n*k;
	ll maxi = 0, mini = 2e15;
	ll a2 = sum - a+1;
	ll a1 = a+1;
	for(ll i = 0; i < n; i++) {
		ll addr = i*k+1;
		ll b1 =  (addr + b-1+sum) % sum+1;
	       	ll b2 = (addr - b+sum-1)%sum + 1;
	       	ll k = sum / __gcd(sum, (b1-a1+sum-1)%sum+1);
	       	maxi = max(maxi, k);
	       	mini = min(mini, k);
	       	k = sum / __gcd(sum, (b2-a1+sum-1)%sum+1);
	       	maxi = max(maxi, k);
	       	mini = min(mini, k);
	       	k = sum / __gcd(sum, (b1-a2+sum-1)%sum+1);
	       	maxi = max(maxi, k);
	       	mini = min(mini, k);
	       	k = sum / __gcd(sum, (b2-a2+sum-1)%sum+1);
	       	maxi = max(maxi, k);
	       	mini = min(mini, k);
	}
	cout << mini << " " << maxi << endl;
}

 #include<bits/stdc++.h>
#define LL long long
using namespace std;

LL n,k,a,b,Mn=1e18,Mx=0;
LL gcd(LL a,LL b){ return !b ? a : gcd(b,a%b); }
void ck(LL l){
	l = n*k/gcd(l,n*k);
	Mn = min(Mn,l),Mx = max(Mx,l);
}

int main(){
	scanf("%I64d%I64d%I64d%I64d",&n,&k,&a,&b);
	for(int i=0;i<=n;i++)
	{
		ck(k*i+a+b);
		if(k*i+a-b>0)ck(k*i+a-b);
	}
	printf("%I64d %I64d\n",Mn,Mx);
}

#include <bits/stdc++.h>
#define endl '\n'
#define Long long long
#define forn(i, n) for(int i = 0; i < n; ++i)
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
using namespace std;

const int MAXN = 1e5;
const Long INF = (1LL << 62);

Long menor = INF;
Long mayor = - INF;

void prueba(Long inicio, Long n, Long k){
    Long T = n * k;
    inicio %= k;
    if(inicio < 0) inicio += k;

    while(inicio <= T){
        Long pasos = T / __gcd(inicio, T);
        menor = min(pasos, menor);
        mayor = max(pasos, mayor);

        inicio += k;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    Long n, k;
    cin >> n >> k;
    Long a, b;
    cin >> a >> b;

    prueba(a + b, n, k);
    prueba(a - b, n, k);
    prueba(-a + b, n, k);
    prueba(-a - b, n, k);

    cout << menor << " " << mayor << endl;

    return 0;
}

#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

std::vector<long long> vec;

long long lcm(long long a, long long b) {
    long long x = a, y = b;
    while (b != 0)
        std::swap(a, b),
        b %= a;
    return y / a;
}

int main() {
    int n, k, x, y;
    long long ans1, ans2 = 0, len;
    std::cin >> n >> k >> x >> y, ans1 = len = n * (long long)k;
    for (int i = 0; i < n; ++i) {
            vec.push_back((long long)i * k + y);
        if (y << 1 != k)
            vec.push_back((i + 1LL) * k - y);
    }
    long long s1 = x, s2 = -x;
    // std::cout << s1 << ' ' << s2 << std::endl;
    for (auto x : vec) {
        // std::cout << "--- " << x << std::endl;
        long long d = x - s1;
        if (d <= 0) d += len;
        long long temp = lcm(d, len);
        // std::cout << "----- " << d << ' ' << temp << std::endl;
        ans1 = std::min(ans1, temp);
        ans2 = std::max(ans2, temp);
        d = x - s2;
        if (d > len) d -= len;
        temp = lcm(d, len);
        // std::cout << "----- " << d << ' ' << temp << std::endl;
        ans1 = std::min(ans1, temp);
        ans2 = std::max(ans2, temp);
    }
    // std::cout << ans1 << ' ' << ans2 << std::endl;
    printf("%lld %lld\n", ans1, ans2);
    return 0;
}

#include <bits/stdc++.h>
#define lli unsigned long long int
#define mod (1000000000 + 7)
#define max_num 1e11

using namespace std;

lli gcd(lli a, lli b)
{
    if(a == 0) return b;
    return gcd(b % a, a);
}

int main()
{
	ios_base::sync_with_stdio(false);
	#ifndef ONLINE_JUDGE
		freopen("in.txt","r",stdin);
	#endif

    lli n, k, a, b;
    cin >> n >> k >> a >> b;
    lli x = max_num, y = 0;
    lli c1 = 0, c2 = 0, c3 = 0, c4 = 0;

    for(lli i = 1; i <= n; i++)
    {
        lli l1 = i*k + a + b;
        lli l2 = i*k + a - b;
        lli l3 = i*k - a + b;
        lli l4 = i*k - a - b;

        if(l1 > 0) c1 = n*k / gcd(l1, n*k);
        if(l2 > 0) c2 = n*k / gcd(l2, n*k);
        if(l3 > 0) c3 = n*k / gcd(l3, n*k);
        if(l4 > 0) c4 = n*k / gcd(l4, n*k);

        if(c1 <= 0) c1 = max_num;
        if(c2 <= 0) c2 = max_num;
        if(c3 <= 0) c3 = max_num;
        if(c4 <= 0) c4 = max_num;
        x = min(x, min(c1, min(c2, min(c3, c4))));

        if(c1 == max_num) c1 = 0;
        if(c2 == max_num) c2 = 0;
        if(c3 == max_num) c3 = 0;
        if(c4 == max_num) c4 = 0;
        y = max(y, max(c1, max(c2, max(c3, c4))));
    }
    cout << x << " " << y << endl;

	return 0;
}

#include <iostream>
#include <climits>
#include <algorithm>

using namespace std;

long long gcd(long long a, long long b) {
	if (b != 0) return gcd(b, a % b);
	return a;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n, k;
	// 1 ~ k;
	cin >> n >> k;
	long long dist = n * k;
	long long a, b;
	cin >> a >> b;

	long long start1 = 1 + a; // + 0*k, 1*k, 2*k ... (n - 1) * k
	long long start2 = k - a + 1; // + 0*k, 1*k, 2*k ... (n - 1) * k
	long long start3 = 1 + b; // + 0*k, 1*k, 2*k ... (n - 1) * k
	long long start4 = k - b + 1; // + 0*k, 1*k, 2*k ... (n - 1) * k

	long long mymin = LLONG_MAX;
	long long mymax = LLONG_MIN;

	for (int i = 0; i < n; i++) {

		long long tmp1 = start3 + i * k;
		long long tmp2 = start4 + i * k;

		long long dist1 = tmp1 - start1;
		long long dist2 = tmp1 - start2;
		long long dist3 = tmp2 - start1;
		long long dist4 = tmp2 - start2;
		if (dist1 < 0) dist1 += dist;
		if (dist2 < 0) dist2 += dist;
		if (dist3 < 0) dist3 += dist;
		if (dist4 < 0) dist4 += dist;

		long long gcd1 = dist / gcd(dist, dist1);
		long long gcd2 = dist / gcd(dist, dist2);
		long long gcd3 = dist / gcd(dist, dist3);
		long long gcd4 = dist / gcd(dist, dist4);

		mymin = min(mymin, gcd1);
		mymin = min(mymin, gcd2);
		mymin = min(mymin, gcd3);
		mymin = min(mymin, gcd4);

		mymax = max(mymax, gcd1);
		mymax = max(mymax, gcd2);
		mymax = max(mymax, gcd3);
		mymax = max(mymax, gcd4);
	}

	cout << mymin << ' ' << mymax;

}

#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
ll gcd(ll a,ll b)
{
	//Write your code here
    if(b==0)
        return a;
    return gcd(b,a%b);
}

void find(int n,int k,int a,int b,int &maxi,int &mini)
{ int s=b;
    while(s<n*k)
{
    int val=(s-a);
    if(val<0)
        val+=k;
    if(val==0)
    {
mini=min(mini,1ll);
maxi=max(maxi,1ll);
      s+=k;
        continue;
    }
    int x=gcd(n*k,val);
    int r=(n*k)/x;
     maxi=max(maxi,r);
     mini=min(mini,r);
    s+=k;
}

}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int a,b;
cin>>a>>b;
int maxi=-1*pow(10,15);
int mini=pow(10,15);
find(n,k,a,b,maxi,mini);
find(n,k,a,k-b,maxi,mini);
find(n,k,k-a,b,maxi,mini);
find(n,k,k-a,k-b,maxi,mini);
cout<<mini<<" "<<maxi<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std ;
int main () {
	long long n, k, a, b;
	cin >> n >> k >> a >> b;
	long long fr = a, sc = k-a ;
	long long x = LLONG_MAX, y = LLONG_MIN ;
	vector <long long> rt ;
	long long tr, fort ;
	for ( long long k1 = k ; k1 < n*k ; k1+=k ) {
		tr = k1+b ; fort = 2*k1-b ;
		rt.push_back ( tr-fr ) ;
		rt.push_back ( fort-fr ) ;
		rt.push_back ( tr-sc ) ;
		rt.push_back ( fort-sc ) ;
	}
	if (a >b ) {
		rt.push_back ( n*k - (a-b) ) ;
		rt.push_back ( (k-b)-a ) ;
		rt.push_back ( (k-b)-(k-a) ) ;
		rt.push_back ( n*k-((k-a)-b) ) ;
	}
	else {
		rt.push_back ( b-a ) ;
		rt.push_back ( n*k-((k-a)-b) ) ;
		rt.push_back ( (k-b)-a ) ;
		rt.push_back ( n*k-((k-a)-(k-b)) ) ;
	}
	long long v = n*k ;
	for ( int i = 0  ; i < rt.size() ; i++ ) {
		if ( rt[i] == 0 ) continue ;
		long long kt = v/(__gcd(rt[i],v)) ;
		x = min (x, kt) ;
		y = max (y, kt) ;
	}
	cout << x << ' ' << y << '\n' ;
}

#include <cstdio>
#include <iostream>
#define ll long long
using std::min;
using std::max;

ll gcd(ll a, ll b){
//	if(a == 0 || b == 0)/*边界问题，随便处理下 (*/
//		return 1;
	while(b ^=a ^=b ^=a %=b) ;
	return a;
}

int main(){
	ll n, k, a, b;
	scanf("%lld%lld%lld%lld", &n, &k, &a, &b);
	ll mn =0x7f7f7f7f7f7f7f7f, mx =-0x7f7f7f7f7f7f7f7f;
	ll start_l[4];
	/*( 下面 "|" 指快餐店，"s0", "s1", 分别指停 0 次，停 1 次，"<-"/"->" 指 a 或 b )*/
	start_l[0] =a+b, start_l[1] =(k-b)-a;/*|-s0->|<-s1-|, |<-s0-s1->|*/
	start_l[2] =(-a)+b, start_l[3] =a+(-b);/*|<-s0-|<-s1-|, |-s0->|-s1->|*/
	for(int i =0; i < 4; ++i)
		for(ll l =start_l[i]; l <= n*k; l +=k){/*因为每次加 k，l 超过 n*k 后取值一定循环*/
			if(l <= 0)
				continue;
			/*xl = ynk*/
		//	ll Lcm =l/gcd(l, n*k)*n*k;
		//	ll x =Lcm/l;/*这里盲猜的结论*/
			ll x =n*k/gcd(l, n*k);/*炸 ll ?*/
			mn =min(mn, x);
			mx =max(mx, x);
		}
	printf("%lld %lld", mn, mx);
}

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

long long n, k, a, b;
vector<long long> nums;

long long f(long long a, long long b)
{
	if (b == 0)
	{
		return a;
	}
	else
	{
		return f(b, a % b);
	}
}

int main()
{
	cin >> n >> k >> a >> b;
	for (int i = 1; i <= n; i++)
	{
		nums.push_back(i * k - a + b);
		nums.push_back(i * k - a - b);
		nums.push_back(i * k + a - b);
		nums.push_back(i * k + a + b);
	}
	sort(nums.begin(), nums.end());
	long long minn = -1, maxx = -1;
	for (int i = 0; i < nums.size(); i++)
	{
		long long val = n * k / f(nums[i], n * k);
		if (minn == -1)
		{
			minn = maxx = val;
		}
		else
		{
			minn = min(minn, val);
			maxx = max(maxx, val);
		}
	}
	cout << minn << " " << maxx << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
constexpr int inf = 0x3f3f3f3f;
constexpr double EPS = 1e-30;
constexpr double PI = atan(1) * 4;

template <typename T> inline bool chmax(T& x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> inline bool chmin(T& x, T y) {return x > y ? x = y, 1 : 0;}
inline int LSB(int i) {return (i & -i);}

ll n, k, a, b, Min = 1e18+5, Max;

ll go(ll x, ll y){
    ll dif = y - x;
    if (y <= x) dif = (y + n * k - x);

    ll lcm = (n * k) / (__gcd(dif, n * k)) * dif;
//    printf("Returns %I64d with LCM of %I64d\n", lcm / dif, lcm);
    return lcm / dif;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> n >> k >> a >> b;

    //Possible start and first stop points (% k)
    ll s1 = 0, s2 = 0;
    s1 = a + 1, s2 = (k + 1) - a;

    ll e1 = b + 1, e2 = (k + 1) - b;
    if (n == 1){
        if (s2 > n * k) s2 -= n * k;
        if (e2 > n * k) e2 -= n * k;
        //Min
        cout << min(min(go(s1, e1), go(s1, e2)), min(go(s2, e1), go(s2, e2))) << " ";

        //Max
        cout << max(max(go(s1, e1), go(s1, e2)), max(go(s2, e1), go(s2, e2))) << endl;
        return 0;
    }

    for (ll i = 1; i < (n * k); i += k){
        e1 = i + b, e2 = (i + k) - b;
        if (e2 > n * k) e2 -= n * k;
        chmin(Min, min(go(s1, e1), go(s1, e2)));
        chmin(Min, min(go(s2, e1), go(s2, e2)));
        chmax(Max, max(go(s1, e1), go(s1, e2)));
        chmax(Max, max(go(s2, e1), go(s2, e2)));
    }

    cout << Min << " " << Max << endl;
    return 0;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
//#pragma comment(linker, "/STACK:16777216")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>

using namespace std;
using namespace __gnu_pbds;

#define LL long long
#define int long long
#define fi first
#define se second
#define pll pair<LL, LL>
#define pii pair<LL, LL>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define SZ(x) ((int)(x.size()))
#define LC (id<<1)
#define RC (id<<1|1)

constexpr int N = 2e6+9;
constexpr int M = 998244353 ;
#ifdef int
constexpr int INF = 0x3f3f3f3f3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcfcfcfcfcf;
#else
constexpr int INF = 0x3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcf;
#endif

int n, k, a, b;

signed main() {
    fastio;
    cin >> n >> k >> a >> b;
    int mini = n*k, maxi = 1;
    for (int x: {a, k-a}) {
        for (int y: {b, k-b}) {
            for (int i = -n; i <= n; i++) {
                int l = y+i*k - x;
                l %= n * k;
                if (l <= 0) l += n * k;
                maxi = max(maxi, n*k / gcd(n*k, l));
                mini = min(mini, n*k / gcd(n*k, l));
            }
        }
    }
    cout << mini << " " << maxi <<"\n";
    return 0;
}

#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
const LL INF = 1e10;
int dx[] = {-1,1,-1,1};
int dy[] = {1,-1,-1,1};
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
int main()
{
    LL n,k,a,b;
    cin >> n >> k >> a >> b;
    LL len = n*k;
    LL x = INF, y = -INF;
    for(int i=0;i<n;++i){
        for(int j=0;j<4;++j){
            LL ix = dx[j]*a+1;
            LL iy = i*k+1+dy[j]*b;
            LL d = (ix-iy+len)%len;
            LL cnt = len/gcd(len,d);
            x = min(x,cnt);
            y = max(y,cnt);
        }
    }
    cout << x << " " << y << endl;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b);}
int main()
{
    ll n, k, a, b;
    scanf("%I64d%I64d%I64d%I64d", &n, &k, &a, &b);
    ll mins = 1ll << 60, maxs = -mins;
    for(int i = 1; i <= n; i++)
    {
        ll l1 = 1ll * i * k + b - a;
        ll l2 = 1ll * i * k - b - a;
        if(!l1 && !l2)  continue;
        else if(!l1) {mins = min(mins, lcm(n * k, l2)), maxs = max(maxs, lcm(n * k, l2));}
        else if(!l2) {mins = min(mins, lcm(n * k, l1)), maxs = max(maxs, lcm(n * k, l1));}
        else
            l1 = lcm(n * k, l1), l2 = lcm(n * k, l2), mins = min(mins, min(l1, l2)), maxs = max(maxs, max(l1, l2));
    }
    printf("%I64d %I64d\n", mins, maxs);
}

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 100005
#define INF 1000000000000000000LL
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
ll n,k,a,b;
int main()
{
    scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
    ll minx=INF,maxx=-INF;
    for(ll i=0;i<2;i++)
        for(ll j=0;j<2;j++)
        {
            ll dis1=(i?a:k-a),dis2=(j?b:k-b);
            ll d=dis2-dis1;
            while(d<=0) d+=k;
            while(d>k) d-=k;
            ll moves=k/__gcd(d,k);
            ll num=d*moves/k;
            for(ll cyc=0;cyc<n;cyc++)
            {
                ll res=(cyc*moves+num)%n;
                ll ans=n/__gcd(n,res)*moves;
                minx=min(minx,ans); maxx=max(maxx,ans);
            }
        }
    printf("%lld %lld\n",minx,maxx);
    return 0;
}

#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define li(x) x.size()-1
#define oo 1000000000
#define inf 1000000000000000000
#define P1 31
#define P2 37
#define M 1000000007
#define M2 1000000009
#define pii pair<ll,ll>
typedef long long ll;
using namespace std;
const int N = 355001;
const int SQRTN = 320;
const int LOGN = 20;
const long double PI = acos(-1);
const long double TAU = 2*PI;

ll nk, n , k , a , b;
vector<ll> first,last;

ll gcd(ll x,ll b){
    if(b==0)return x;
    return gcd(b,x%b);
}

signed main(){
    cin >> n >> k >> a >> b;
    nk=n*k;
    first.push_back(a);
    first.push_back(k-a);
    last.push_back(b);
    last.push_back(k-b);
    for(int i = 0 ; i < n ;i++){
        last.push_back((last[0]+nk-i*k)%nk);
        last.push_back((last[1]+nk-i*k)%nk);
        last.push_back((i*k+last[0])%nk);
        last.push_back((i*k+last[1])%nk);
    }
    ll mn =100000000000000ll,mx=0;
    for(int i = 0 ; i < last.size() ; i++){
        mn = min(mn,nk/gcd(nk,abs(last[i]-first[0])));
        mx = max(mx,nk/gcd(nk,abs(last[i]-first[0])));
        mx = max(mx,nk/gcd(nk,abs(last[i]-first[1])));
        mn = min(mn,nk/gcd(nk,abs(last[i]-first[1])));
    }
    cout << mn << " " << mx << endl;
}

#include <bits/stdc++.h>
using namespace std;

const int64_t inf = 1e18;
int64_t n, k;

int64_t calc(int64_t a, int64_t b, int64_t z) {
    int64_t c = (a + b + k) % k;
    int64_t l = k * z + c;
    return n * k / __gcd(n * k, l);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int64_t a, b;

    cin >> n >> k;
    cin >> a >> b;

    int64_t x = inf, y = 0;

    for (int z = 0; z < n; z++) {
        x = min({x, calc(a, b, z), calc(-a, b, z), calc(a, -b, z), calc(-a, -b, z)});
        y = max({y, calc(a, b, z), calc(-a, b, z), calc(a, -b, z), calc(-a, -b, z)});
    }

    cout << x << " " << y << "\n";

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define pb(x) push_back((x))
#define REP(i,x,y) for(long long (i)=(x);(i)<(y);(i)++)
#define PER(i,x,y) for(long long (i)=(x);(i)>=(y);(i)--)
#define REPIT(it,A) for(typeof(A.begin()) it = (A.begin()); it!=A.end();it++)
#define sqr(x) ((x)*(x))
#define mp(x,y) make_pair((x),(y))
#define mt(x,y,z) mp(mp((x),(y)),z)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define trace(x) cout << #x << " = " << x << endl
//#define NDEBUG 1
#define fst first
#define snd second
#define sz(v) ((int)v.size())
#define itm1 fst.fst
#define itm2 fst.snd
#define itm3 snd
#define MAX 100000000
typedef vector<int> vi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<ii,ull> tri;
typedef vector<ii> vii;
typedef vector<tri> vt;
typedef vector<ll> vll;

ll n,k,a,b;
set<ll> posL;

ll gcd(ll a, ll b)
 {
    if(b==0) return a;
   a%=b;
   return gcd(b,a);
 }

// Function to return LCM of two numbers
ll lcm(ll a, ll b)
 {
    return a/__gcd(a, b);
 }

ll remod(ll x, ll m){
	return (x%m +m)%m;
}

int main(){
	fastio;
	cin>>n>>k>>a>>b;

	ll s=remod(a,n*k);

	//if(1 || k-a-b >= 0)
	posL.insert(k-a-b);
	//if(1 || a-b >= 0)
	posL.insert(a-b);

	for(ll i = k-a+b; i<=n*k; i+=k){
		//if(1 || i>=0)
		posL.insert(i);
		//cout<<i<<endl;
	}

	for(ll i = a+b; i<=n*k; i+=k){
		//if(1 || i>=0)
		posL.insert(i);
	}

	ll mini = 1e17, maxi = -1e17;
	for(set<ll>::iterator it = (posL.begin()); it!=posL.end();it++)
	{
		ll cur;
		if(*it!=0){
			ll val = *it;
			if(val<0) val = ((val)+n*k)%(n*k);
			//cout<<val<<endl;
			cur = lcm((n*k),val);
		}else{
			cur = 1;
		}

		maxi = max(maxi, cur);
		mini = min(mini, cur);
	}

	cout<<mini<<" "<<maxi<<endl;
	return 0;
}

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
/************** [Faster I/O FUNCTIONS] **************/
#define     pf                  printf
#define     sfs(a)              scanf("%s",&a)
#define     sfi1(a)             scanf("%d",&a)
#define     sfi2(a,b)           scanf("%d %d",&a,&b)
#define     sfi3(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define     sfi4(a,b,c,d)       scanf("%d %d %d %d",&a,&b,&c,&d)
#define     sfd1(a)             scanf("%lf",&a)
#define     sfd2(a,b)           scanf("%lf %lf",&a,&b)
#define     sfd3(a,b,c)         scanf("%lf %lf %lf",&a,&b,&c)
#define     sfd4(a,b,c,d)       scanf("%lf %lf %lf %lf",&a,&b,&c,&d)
#define     sfll1(a)            scanf("%lld",&a)
#define     sfll2(a,b)          scanf("%lld %lld",&a,&b)
#define     sfll3(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define     sfll4(a,b,c,d)      scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define     sfull1(a)           scanf("%llu",&a)
#define     sfull2(a,b)         scanf("%llu %llu",&a,&b)
#define     sfull3(a,b,c)       scanf("%llu %llu %llu",&a,&b,&c)
/************** [LEGENDS/CONSTANTS] **************/
#define hi cout<<"Hi, BIJOY...!"<<nl
#define nl '\n'
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
#define F first
#define S second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plp;
typedef pair<pll, ll> ppl;
typedef pair<int, int> pii;
typedef pair<int, pii> pip;
typedef pair<pii, int> ppi;
#define all(v)          v.begin(),v.end()
#define valid(tx,ty)    tx>=0&&tx<r&&ty>=0&&ty<c
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define fast            ios_base::sync_with_stdio(0),cin.tie(0)
#define Unique(x)       x.erase(unique(x.begin(),x.end()),x.end())
ll POW(ll b,ll p) {ll Ans=1; while(p){if(p&1)Ans=(Ans*b);b=(b*b);p>>=1;}return Ans;}
ll BigMod(ll b,ll p,ll Mod) {ll Ans=1; while(p){if(p&1)Ans=(Ans*b)%Mod;b=(b*b)%Mod;p>>=1;}return Ans;}
ll ModInverse(ll p,ll Mod) {return BigMod(p,Mod-2,Mod);}

///geometri_basic
struct Point{double x,y;};
struct StateLine{double x,y,c;};
StateLine line(Point A, Point B){StateLine L;L.x=B.y-A.y;L.y=A.x-B.x;L.c=L.x*A.x+L.y*A.y;return L;}
StateLine lombo_line(Point A, Point B){
    Point M;M.x=(A.x+B.x)/2.00;M.y=(A.y+B.y)/2.00;
    StateLine L; L.x=A.x-B.x;L.y=A.y-B.y;L.c=M.x*B.x-M.x*A.x+M.y*B.y-M.y*A.y;return L;
}
Point line_intersect(StateLine A, StateLine B){Point P;double d=(A.x*B.y-B.x*A.y);if(d==0){/*parallel;*/}
    P.x=(B.y*A.c-A.y*B.c)/d;P.y=(A.x*B.c-B.x*A.c)/d;return P;}
    double Distance(Point A, Point B){return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}

///Ordered Set
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>order_set;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*st.find_by_order(x) && st.order_of_key(x)
typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>prefix_trie;
//auto range = st.prefix_range(string) && (auto it=range.first;it!=range.second;it++)

#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args> void deb(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;deb(++it, args...);}

//bool mark[1000010];vector<int>prime;
//void sieve(){memset(mark,true,sizeof(mark));for(int i=3;i<=(int)sqrt(1000010);i+=2){if(mark[i]){for(int j=i*i;j<=1000010;j+=2*i) mark[j]=false;}}
//prime.push_back(2);for(int i=3;i<=1000010;i+=2) if(mark[i]) prime.push_back(i);}
const int fx[]      = {+0,+0,+1,-1,-1,+1,-1,+1};
const int fy[]      = {-1,+1,+0,+0,+1,+1,-1,-1};
const int mxn       = (3*5000)+10 , inf = 0x3f3f3f3f;
const double pi     = 2*acos(0.0);
const double E      = 2.71828182845904523536, EPS = 1e-9;
const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18;
auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();
#define BIJOY 2016331012
#define OImode 227420978

#undef BIJOY
#undef OImode
/*************Code start here****************************/
ll lcm(ll x,ll y){
    ///x*y not because it's the behind ligic
    return (x/__gcd(x,y));
}

void Solve(){

    ll n,k,a,b;
    cin>>n>>k>>a>>b;

    ll mn=LINF;
    ll mx = -LINF;

    if(a==b){
        mn = 1;

        ll d = abs(a-b);
        ll tem = lcm(n*k,d);
        mx = max(mx,tem);
        while(d<n*k){

           d+=k;
           if(d>n*k){
                break;
           }

           tem = lcm(n*k,d);
           mx = max(mx,tem);
        }

        d = k-a-b;
        if(d!=0LL) {

            tem = lcm(n*k,d);
            mx = max(mx,tem);
        }
        while(d<n*k){

           d+=k;
           if(d>n*k){
                break;
           }
           tem = lcm(n*k,d);
           mx = max(mx,tem);
        }
        cout<<mn<<" "<<mx<<nl;
    }
    else{
        // hi;
        ll d = abs(a-b);
        ll tem = lcm(n*k,d);
        mx = max(mx,tem);
        while(d<n*k){

           d+=k;
           if(d>n*k){
                break;
           }

           tem = lcm(n*k,d);
           mx = max(mx,tem);
        }

        d = k-a-b;

        if(d!=0LL) {

            tem = lcm(n*k,d);
            mx = max(mx,tem);
        }
        while(d<n*k){

           d+=k;
           if(d>n*k){
                break;
           }
           tem = lcm(n*k,d);
           mx = max(mx,tem);
        }

        //for min number er jonno
        d = abs(a-b);
        tem = lcm(n*k,d);
        mn = min(mn,tem);
        while(d<n*k){

           d+=k;
           if(d>n*k){
                break;
           }
           tem = lcm(n*k,d);
           mn = min(mn,tem);
        }

        d=k-a-b;
        if(d!=0LL) {

            tem = lcm(n*k,d);
            mn = min(mn,tem);
        }
        while(d<n*k){

           d+=k;
           if(d>n*k){
                break;
           }
           tem = lcm(n*k,d);
           mn = min(mn,tem);
        }

        cout<<mn<<" "<<mx<<nl;
    }

    return;
}

int32_t main(int argc, char* argv[]) {
    #ifdef OImode
        freopen("Input.txt","r",stdin);
        freopen("Output.txt","w",stdout);
    #endif
    #ifdef BIJOY
        TimeStart = chrono::steady_clock::now();
    #endif

    Solve();

    #ifdef BIJOY
        TimeEnd = chrono::steady_clock::now();
        auto ElapsedTime = TimeEnd - TimeStart;
        cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n";
    #endif
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll>elem;
ll n,l,k,a,b,mn=LLONG_MAX,mx;
ll pos[2];
unordered_map<ll,bool>mp;
unordered_map<ll,bool>::iterator it;
void find_dist(ll where)
{
    for(int i=0;i<2;i++)
    {
        mp[abs(where-pos[i])]=true;
        mp[n*k-abs(where-pos[i])]=true;
    }
}
ll gcd(ll a,ll b)
{
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int main()
{
    cin>>n>>k;
    cin>>a>>b;
    pos[1]=1+a;
    pos[0]=n*k-a+1;
    for(ll i=0;i<n;i++)
    {
        ll where=(i*k+1)+b;
        find_dist(where);
        where-=2*b;
        if(where<=0)where+=n*k;
        find_dist(where);
    }
    for(it=mp.begin();it!=mp.end();it++)
        elem.push_back(it->first);
    n*=k;
    for(int i=0;i<elem.size();i++)
    {
        if(elem[i]<=0 || elem[i]>n)continue;
        ll ans=(n/gcd(n,elem[i]));
        if(ans<mn && ans>0)
            mn=ans;
        if(ans>mx)
            mx=ans;
    }
    cout<<mn<<" "<<mx;
    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll inf=10000000010;
ll n,k,a,b,l,minn=inf,maxx=-inf;
ll gcd(ll x,ll y){return (x%y)?gcd(y,x%y):y;}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
	for(l=(a+b)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(a-b+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(-a+b+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(-a-b+k+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	printf("%lld %lld\n",minn,maxx);
	return 0;
}

#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

LL gcd(LL a, LL b) { while (b) { a %= b; swap(a, b); } return a; }
LL lcm(LL a, LL b) { return (b / gcd(a, b)); }

int main()
{
//    cout << ULLONG_MAX << endl;
    LL n, k;
    I(n, k);
    int a, b;
    I(a, b);
    vector<int> s, f;
    if (a == 0) {
        s.pb(1);
    }
    else if ((1 + a) == (k - (a - 1))) {
        s.pb(1 + a);
    }
    else {
        s.pb(1 + a);
        s.pb(k - a + 1);
    }
    if (b == 0) {
        f.pb(1);
    }
    else if ((1 + b) == (k - (b - 1))) {
        f.pb(1 + b);
    }
    else {
        f.pb(1 + b);
        f.pb(k - b + 1);
    }
    LL x = LLONG_MAX, y = LLONG_MIN;
    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < f.size(); j++) {
            LL l = abs(s[i] - f[j]);
            while (l <= n * k) {
                LL z;
                if (!l) goto skip;
                z = lcm(l, n * k);
//                z = z / l;
                x = min(x, z);
                y = max(y, z);
                skip:;
                l += k;
            }
        }
    }
    O(x, y);

    return 0;
}

#include <bits/stdc++.h>
#define ll long long int
#define INF 100000000007
#define f(n) for(int d = 0; d < n; d++)
#define pb push_back
#define pf push_front
#define lca(n) ll n; cin>>n
#define coutVec(n) for(int d = 0; d < n.size(); d++) cout<<n[d]<<" ";
using namespace std;
ll gcd(ll a, ll b)
{
    if(b == 0)
    {
        return a;
    }
    return gcd(b, a%b);
}
int main()
{
    cin.tie(NULL);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, k, a, b;
    cin>>n>>k>>a>>b;
    ll min1 = n*k;
    ll max1 = 1;
    if(a == b)
    {
        min1 = 1;
    }
    //cout<<min1<<" "<<max1<<"\n";
    ll ch = k;
    for(int d = 0; d <= n; d++)
    {
        ll k1 = ch - a - b;
        ll x1 = gcd(k1, n*k);
        ll x2 = ((n*k) / x1);
        min1 = min(x2, min1);
        max1 = max(x2, max1);
        k1 = ch + b - a;
        x1 = gcd(k1, n*k);
        x2 = ((n*k) / x1);
        min1 = min(x2, min1);
        max1 = max(x2, max1);
        k1 = ch +a - b;
        x1 = gcd(k1, n*k);
        x2 = ((n*k) / x1);
        min1 = min(x2, min1);
        max1 = max(x2, max1);
        k1 = ch + a + b;
        x1 = gcd(k1, n*k);
        x2 = ((n*k) / x1);
        min1 = min(x2, min1);
        max1 = max(x2, max1);
        ch += k;

    }
    cout<<min1<<" "<<max1;
}

#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n, k, a, b; cin>>n>>k>>a>>b;
	vector<ll> dx = {(a + b)%k, (-a - b + k)%k, (a - b + k)%k, (b - a + k)%k};
	ll ansmin = 1e18, ansmax = -1;
	for(ll x = 0; x < n; ++x){
		for(ll c : dx){
			ll l = k*x + c;
			ansmin = min(ansmin, n*k / __gcd(n*k, l));
			ansmax = max(ansmax, n*k / __gcd(n*k, l));
		}
	}
	cout<<ansmin<<" "<<ansmax<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	int a,b;
	cin>>a>>b;
	int c1=k-b-a;
	int c2=(k+b-a)%k;
	int c3=(a+b)%k;
	int c4=(k+a-b)%k;
	set<int> s;
	// cout<<c1<<" "<<c2<<" "<<c3<<" "<<c4<<"\n";
	for(int i=0;i<=n;++i)
	{
		int c=(c1+i*k);
		s.insert(k*n/__gcd(c,k*n));
		c=(c2+i*k);
		s.insert(k*n/__gcd(c,k*n));
		c=(c3+i*k);
		s.insert(k*n/__gcd(c,k*n));
		c=(c4+i*k);
		s.insert(k*n/__gcd(c,k*n));
	}
	cout<<*s.begin()<<" "<<*(--s.end());
}

#include <bits/stdc++.h>

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back;
#define fst first
#define snd second

typedef long long ll;

int main() {
    ll n, k; cin >> n >> k;
    ll a, b; cin >> a >> b;

    ll s1 = 1 + a, s2 = (k + 1 - a) % k;

    ll t1 = 1 + b, t2 = (k + 1 - b) % k;

    ll f1 = s1 - t1, f2 = s1 - t2, f3 = s2 - t1, f4 = s2 - t2;

    if(f1 < 0) f1 += k;
    if(f2 < 0) f2 += k;
    if(f3 < 0) f3 += k;
    if(f4 < 0) f4 += k;

    map<ll, int> f;

    fore(i, 0, n) {
        f[f1 + i * k]++;
        f[f2 + i * k]++;
        f[f3 + i * k]++;
        f[f4 + i * k]++;
    }

    ll m = 1e18, mm = 0;

    for(auto x : f) {
        ll t = abs(x.fst);
        if(x.fst == 0) t = n * k;
        // cout << t << endl;
        m = min(n * k / __gcd(n*k, t), m);
        mm = max(n * k / __gcd(n*k, t), mm);
    }
    cout << m << " " << mm << endl;
    return 0;
}

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll gcd(ll a, ll b) {
    if(b == 0) return a;
    else return gcd(b, a%b);
}
int main() {
    ll n,k,a,b,x,y;
    cin >> n >> k >> a >> b;
    ll tot = n*k;
    ll minn = tot+1;
    ll maxx = 0;
    for(ll i = 0; i < 2; i++) for(ll j = 0; j < 2; j++) {
        if(i == 0) x = a;
        else x = (k-a)%k;
        if(j == 0) y = b;
        else y = (k-b)%k;
        x += (k-y);
        x %= k;
        for(ll m = 0; m < n; m++) {
            y = x + m * k;
            y = gcd(tot, y);
            y = tot/y;
            minn = min(minn, y);
            maxx = max(maxx, y);
        }
    }
    cout << minn << " " << maxx << endl;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<long long> vll;

vll dist;

ll gcd(ll a, ll b) { return (b==0) ? a : gcd(b,a%b);}
ll mcm(ll a, ll b) { return a / gcd(a,b); }

main() {
	ll n, k,a,b;
	cin >> n >> k >> a >> b;
	ll dis1 = abs(a - b), dis2 = abs(k - b - a);
	for(int i=0;i<n;++i){
		ll val = dis1 + (ll)i*k;
		if(val!=0) dist.push_back(val);
		else dist.push_back(n*k);
	}
	if(dis1!=dis2){
		for(int i=0;i<n;++i){
			ll val = dis2 + (ll)i*k;
			if(val!=0) dist.push_back(val);
			else dist.push_back(n*k);
		}
	}
	ll maxi = 0;
	ll mini = 0;
	for(int i=0;i<dist.size();++i){
		//if(dist[i] < 0 ) cout << dist[i] << endl;
		ll temp = mcm(n*k,dist[i]) ;
		maxi = max(maxi,temp);
		if(mini!=0) mini = min(mini,temp);
		else mini = temp;
	}
	cout << mini << " " << maxi;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
ll n,k,a,b;
ll maxx=0,minn=1000000000000000000;
int main()
{
	scanf("%I64d%I64d",&n,&k);
	scanf("%I64d%I64d",&a,&b);
	for(int i=0;i<=n;i++)
	{
		ll x=1ll*i*k-b;
		maxx=max(maxx,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
		minn=min(minn,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
		x=1ll*i*k+b;
		maxx=max(maxx,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
		minn=min(minn,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
	}
	a=k-a;
	for(int i=0;i<=n;i++)
	{
		ll x=1ll*i*k-b;
		maxx=max(maxx,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
		minn=min(minn,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
		x=1ll*i*k+b;
		maxx=max(maxx,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
		minn=min(minn,abs(1ll*n*k/__gcd(1ll*n*k,x-a)));
	}
	printf("%I64d %I64d\n",minn,maxx);
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll inf=10000000010ll;
ll n,k,a,b,l,minn=inf,maxx=-inf;
ll gcd(ll x,ll y){return (x%y)?gcd(y,x%y):y;}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
	for(l=(a+b)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(a-b+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(-a+b+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(-a-b+k+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	printf("%lld %lld\n",minn,maxx);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

template<class T1,class T2>
ostream& operator << (ostream& out,pair<T1,T2> p)
{
	out<<p.first<<' '<<p.second;
	return out;
}

template<class T1,class T2>
istream& operator >> (istream& in,pair<T1,T2> &p)
{
	in>>p.first>>p.second;
	return in;
}

template<class T>
istream& operator >> (istream& in,vector<T> &v)
{
	for(auto &x:v)
		in>>x;
	return in;
}

template<class T>
ostream& operator << (ostream& out,vector<vector<T>> &v)
{
	for(auto &x:v)
		out<<x<<'\n';
	return out;
}

template<class T>
ostream& operator << (ostream& out,vector<T> &v)
{
	for(auto x:v)
		out<<x<<' ';
	return out;
}

#define ll           long long
#define ld           long double
#define int          long long
#define f            first
#define s            second
#define boost        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cerr.tie(0);
#define rep(i,a,b)   for(int i=a;i<b;i++)
#define pb           push_back
#define vi           vector<int>
#define vvi          vector<vi>
#define vll          vector<ll>
#define pii          pair<int,int>
#define pll          pair<ll,ll>
#define all(x)       x.begin(),x.end()
#define sz(x)        (int)x.size()
#define mp           make_pair
//#define M            998244353
//#define N            10000005
#define mod          1000000007

int gcd(int a,int b){
	while(b>0){
		int t=a%b;
		a=b;
		b=t;
	}
	return a;
}

void solve(){
    int n,k;
	cin>>n>>k;
	int a,b;
	cin>>a>>b;
	int mxgcd=1;
	int mngcd=n*k;
	int g;
	//Case1
	g=(b-a+k)%k;
	rep(i,0,n+1){
		mxgcd=max(mxgcd,gcd(n*k,i*k+g));
		mngcd=min(mngcd,gcd(n*k,i*k+g));
	}
	//Case2
	g=(k-b-a+9*k)%k;
	rep(i,0,n+1){
		mxgcd=max(mxgcd,gcd(n*k,i*k+g));
		mngcd=min(mngcd,gcd(n*k,i*k+g));
	}
	//Case3
	g=(k-a+b)%k;
	rep(i,0,n+1){
		mxgcd=max(mxgcd,gcd(n*k,i*k+g));
		mngcd=min(mngcd,gcd(n*k,i*k+g));
	}
	//Case4
	g=(2*k-a-b)%k;
	rep(i,0,n+1){
		mxgcd=max(mxgcd,gcd(n*k,i*k+g));
		mngcd=min(mngcd,gcd(n*k,i*k+g));
	}
	cout<<n*k/mxgcd<<' '<<n*k/mngcd<<endl;
}

signed main()
{
    boost;
    int t;
    t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(long long i=0;i<n;i++)
#define rev(i,n) for(long long i=n;i>=0;i--)
#define rev_a(i,a,n) for(long long i=n;i>=a;i--)
#define rep_a(i,a,n) for(long long i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue < long long ,vector<long long> ,greater<long long>> pq;
typedef vector< long long > vi;
typedef pair< long long, long long > ii;
#define o_set tree< ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update >
#define graph vector<vector<long long>>

const ll MAX = 143;
const ll mod = 1e9+7;

ll po(ll x, ll n ){
	ll ans=1;
     while(n>0){
     	if(n&1) ans=(ans*x)%mod;
     	x=(x*x)%mod;
     	n/=2;
     }
     return ans%mod;
}

ll n,k,a,b;

bool isValid(ll l){
	cout << "L " << l << el;
	ll rhs=a-b+l;
	if(rhs<0) rhs += k*100;
	cout << rhs%k << el;
	if(rhs%k==0) return 1;
	rhs=l-a-b;
	cout << rhs%k << el;
	if(rhs<0) rhs += k*100;
	if(rhs%k==0) return 1;
	rhs=l+a+b;
	cout << rhs%k << el;
	if(rhs<0) rhs += k*100;
	if(rhs%k==0) return 1;
	rhs=l+b-a;
	cout << rhs%k << el;
	if(rhs<0) rhs += k*100;
	if(rhs%k==0) return 1;
	cout << el;
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r" , stdin);
	//freopen("output.txt", "w" , stdout);
	#endif

	ll tt=1;
	//cin >> tt;

	while(tt--){
		cin >> n >> k >> a >> b;
		ll mn=1e18,mx=-1e18,v1=a+b,v2=a-b,v3=b-a,v4=-a-b;
		rep(y,n+1){
			if(y*k+v1>=0){
				mn=min(mn,(n*k)/__gcd(n*k,y*k+v1));
				mx=max(mx,(n*k)/__gcd(n*k,y*k+v1));
			}
			if(y*k+v2>=0){
				mn=min(mn,(n*k)/__gcd(n*k,y*k+v2));
				mx=max(mx,(n*k)/__gcd(n*k,y*k+v2));
			}
			if(y*k+v3>=0){
				mn=min(mn,(n*k)/__gcd(n*k,y*k+v3));
				mx=max(mx,(n*k)/__gcd(n*k,y*k+v3));
			}
			if(y*k+v4>=0){
				mn=min(mn,(n*k)/__gcd(n*k,y*k+v4));
				mx=max(mx,(n*k)/__gcd(n*k,y*k+v4));
			}
		}
		cout << mn << " " << mx << el;
	}
	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define LL long long
int n,k,A,B;
LL mn,mx;
LL cir;
inline void check(LL len){
	//cerr<<__gcd(cir,len)<<endl;
	mn=min(mn,cir/__gcd(cir,len));
	mx=max(mx,cir/__gcd(cir,len));
}
int main(){
	mn=1e17;
	cin>>n>>k>>A>>B;
	cir=1ll*n*k;
	for(int i=0;i<n;++i){
		LL A1=(k-A)%cir+1;
		LL A2=A+1;
		LL B1=(k-B)%cir+1+1ll*i*k;
		LL B2=B+1+1ll*i*k;
		check((B1-A1+cir-1)%cir+1);
		check((B2-A1+cir-1)%cir+1);
		check((B1-A2+cir-1)%cir+1);
		check((B2-A2+cir-1)%cir+1);
	}
	cout<<mn<<" "<<mx<<endl;
}
/*
100000 100000
50000 50000
*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 2333333333333333333LL

ll n,k,a,b;

inline ll rd()
{
	ll x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline ll gcd(ll x,ll y) { return (!y)?x:gcd(y,x%y); }

int main()
{
	n=rd();k=rd();a=rd();b=rd();
	ll mn=inf,mx=0;
	if (a<=b)
	{
		ll hh=b-a;
		for (ll i=0;i<=n;i++)
		{
			if (!hh&&!i) continue;
			ll now=hh+k*i;
			mn=min(mn,n*k/gcd(n*k,now));
			mx=max(mx,n*k/gcd(n*k,now));
		}
		hh=k-b-a;
		for (ll i=0;i<=n;i++)
		{
			if (!hh&&!i) continue;
			ll now=hh+k*i;
			mn=min(mn,n*k/gcd(n*k,now));
			mx=max(mx,n*k/gcd(n*k,now));
		}
		hh=a+b;
		for (ll i=0;i<=n;i++)
		{
			if (!hh&&!i) continue;
			ll now=hh+k*i;
			mn=min(mn,n*k/gcd(n*k,now));
			mx=max(mx,n*k/gcd(n*k,now));
		}
	}
	else
	{
		ll hh=k-b-a;
		for (ll i=0;i<=n;i++)
		{
			if (!hh&&!i) continue;
			ll now=hh+k*i;
			mn=min(mn,n*k/gcd(n*k,now));
			mx=max(mx,n*k/gcd(n*k,now));
		}
		hh=a+b;
		for (ll i=0;i<=n;i++)
		{
			if (!hh&&!i) continue;
			ll now=hh+k*i;
			mn=min(mn,n*k/gcd(n*k,now));
			mx=max(mx,n*k/gcd(n*k,now));
		}
		hh=a-b;
		for (ll i=0;i<=n;i++)
		{
			if (!hh&&!i) continue;
			ll now=hh+k*i;
			mn=min(mn,n*k/gcd(n*k,now));
			mx=max(mx,n*k/gcd(n*k,now));
		}
	}
	printf("%lld %lld\n",mn,mx);
	return 0;
}

#include <bits/stdc++.h>
#define MAX (ll)(1e5 + 3)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e15)

using namespace std;
using ll = long long;
using ld = long double;

ll gc (ll a, ll b) {
	ll r = a % b;
	assert (a && b);
	while (r) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int main () {
	ll n, k, a, b, pr;
	cin >> n >> k >> a >> b;
	pr = n * k;
	ll mi = INF, ma = 1, ad = 0, ans = 0;
	ll re[] = {a + b, pr - a - b, abs (a - b), pr - abs (a - b)};
	for (int i = 0; i < n; i++) {
		for (ll x : re) {
			x += ad;
			x %= pr;
			if (x == 0) {
				mi = 1;
			}
			else {
				ans = ((pr) / gc (pr, x));
				mi = min (ans, mi);
				ma = max (ans, ma);
			}
		}
		ad += k;
	}
	cout << mi << " " << ma << "\n";
}

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define N 100005
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define print(x) cout << #x << "=" << x << "\t";

ll n;
ll k;
ll a;
ll b;
ll ma = -1e18;
ll mi = 1e18;

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);

    cin >> n >> k >> a >> b;

    for(ll i=0;i<=n;i++) {
        ll l = i * k + b + a;
        if (l <= 0)
            continue;
        ll g = __gcd(n * k, l);
        ll lcm = n * k / g;
        ma = max(ma, lcm);
        mi = min(mi, lcm);
    }

    for(ll i=0;i<=n;i++) {
        ll l = (i + 1) * k - b + a;
        ll g = __gcd(n * k, l);
        ll lcm = n * k / g;
        ma = max(ma, lcm);
        mi = min(mi, lcm);
    }

    for(ll i=0;i<=n;i++) {
        ll l = (i + 1) * k - a + b;
        ll g = __gcd(n * k, l);
        ll lcm = n * k / g;
        ma = max(ma, lcm);
        mi = min(mi, lcm);
    }

    for(ll i=0;i<=n;i++) {
        ll l = (i + 2) * k - a - b;
        ll g = __gcd(n * k, l);
        ll lcm = n * k / g;
        ma = max(ma, lcm);
        mi = min(mi, lcm);
    }

    cout << mi << " " << ma;
    return 0;
}

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author majk
 */

#ifndef MAJK_LIB
#define MAJK_LIB

#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <array>
#include <bitset>
using namespace std;

#define x first
#define y second
typedef std::pair<int,int> pii; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<ui,ui> puu;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T> bool in(T a, T b, T c) { return a <= b && b < c; }
ui logceil(ll x) { return x?8*sizeof(ll)-__builtin_clzll(x):0; }

namespace std { template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}}; }
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename F> double bshd(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){l=m;}else{h=m;}}return (l+h)/2;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename F> double bsld(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){h=m;}else{l=m;}}return (l+h)/2;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

template<typename T>class vector2:public vector<vector<T>>{public:vector2(){} vector2(size_t a,size_t b,T t=T()):vector<vector<T>>(a,vector<T>(b,t)){}};
template<typename T>class vector3:public vector<vector2<T>>{public:vector3(){} vector3(size_t a,size_t b,size_t c,T t=T()):vector<vector2<T>>(a,vector2<T>(b,c,t)){}};
template<typename T>class vector4:public vector<vector3<T>>{public:vector4(){} vector4(size_t a,size_t b,size_t c,size_t d,T t=T()):vector<vector3<T>>(a,vector3<T>(b,c,d,t)){}};
template<typename T>class vector5:public vector<vector4<T>>{public:vector5(){} vector5(size_t a,size_t b,size_t c,size_t d,size_t e,T t=T()):vector<vector4<T>>(a,vector4<T>(b,c,d,e,t)){}};

#endif

class ATheBeatles {
public:
    void solve(istream& cin, ostream& cout) {
        ll N, K; cin >> N >> K;
        ll A, B; cin >> A >> B;
        ll mn = N*K, mx = 0;
        for (int c: {(K+B-A)%K, (2*K-A-B)%K, (A+B)%K, (K+A-B)%K}) {
            for (int k = 0; k < N; ++k) {
                ll l = k * K + c;
                ll len = N * K / gcd(N*K, l);
                mn = min(mn, len);
                mx = max(mx, len);
            }
        }
        cout << mn << ' ' << mx << endl;
    }
};

int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	ATheBeatles solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
    return 0;
}

#include <bits/stdc++.h>
#define fastIO  std::ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long int
#define vi vector<int>
#define pi pair<int,int>
#define ff first
#define ss second
#define MOD 1000000007
#define MMOD  998244353
#define pb push_back

//gcd in O(log()
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

signed main(void)
{
    fastIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--)
    {
        int n, k;
        cin >> n >> k;
        int a, b;
        cin >> a >> b;
        int l = a + b + k;
        int m = k + a - b;
        int y = 2 * k - a - b;
        int x = k - a + b;
        int mn = 1e18;
        int mx = 0;
        int total = n * k;
        for (int i = 0; i < n + 2; i++)
        {
            int temp;
            temp = total / (  gcd(total, l));
            mn = min(mn, temp );
            mx = max(mx, temp );
            temp = total / (  gcd(total, m));
            mn = min(mn, temp);
            mx = max(mx, temp );
            temp = total / ( gcd(total, y));
            mn = min(mn, temp );
            mx = max(mx, temp);
            temp = total / ( gcd(total, x));
            mn = min(mn, temp );
            mx = max(mx, temp );
            l += k;
            m += k;
            y += k;
            x += k;
        }

        cout << mn << " " << mx << endl;

    }

}

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
long long int gcd(long long int a,long long int b)
{
   if (b == 0)
      return a;
   return gcd(b, a % b);
}
int main()
{
	long long int n,k,max=0,min=1e11,a,b,x,y;
	cin>>n>>k>>a>>b;
	long long int t=n*k;
	x=gcd(t,a+b);
	y=gcd(t,a-b+k);
	if (x<y)
	{
		if (y>max)
		{
			max=y;
		}
		if (x<min)
		{
			min=x;
		}
	}
	else
	{
		if (y<min)
		{
			min=y;
		}
		if (x>max)
		{
			max=x;
		}
	}
	for (int i = 1; i < n; ++i)
	{
		x=gcd(t%(a+b+i*k),a+b+i*k);
		y=gcd(t%(a-b+(i+1)*k),a-b+(i+1)*k);
		if (x<y)
		{
			if (y>max)
			{
				max=y;
			}
			if (x<min)
			{
				min=x;
			}
		}
		else
		{
			if (y<min)
			{
				min=y;
			}
			if (x>max)
			{
				max=x;
			}
		}
	}
	cout<<t/max<<" "<<t/min<<endl;
}

//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair

const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;
LL n, k;

LL getL(LL x)
{
	x = x % k;
	for (LL i = 1; i <= k; i++){
		if ((x + i + k) % k == 0)
			return i;
	}
}

LL LCM (LL a, LL b)
{
	LL temp = b / __gcd(a, b);
	return temp;
}

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k;

    LL a, b; cin >> a >> b;

    LL x = getL(b - a);
    vector<LL> ans;

    for ( ; x <= 2LL * n * k; x += k){
    	ans.PB(LCM(x, n * k));
    }

    x = getL(- b - a);
    for ( ; x <= 2LL * n * k; x += k){
    	ans.PB(LCM(x, n * k));
    }

    x = getL(b + a);
    for ( ; x <= 2LL * n * k; x += k){
    	ans.PB(LCM(x, n * k));
    }

    x = getL(- b + a);
    for ( ; x <= 2LL * n * k; x += k){
    	ans.PB(LCM(x, n * k));
    }
    sort (ans.begin(), ans.end());
    cout << ans[0] << " " << ans[int(ans.size() - 1)] << endl;
	return 0;
}

#include<bits/stdc++.h>
#include <queue>
#include<map>
#define ll long long
#define ull unsigned long long
#define ld long double
#define all(ar) ar.begin(), ar.end()
#define sot(bello) bello.begin(),bello.end()
#define bitc  __builtin_popcountl
#define mp make_pair
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define MAXN   100010
#define MOD 1000000007
#define debug(x) cout<<#x<<": "<<x<<endl
#define dbug(x) cout<<#x<<": "<<x<<" "
#define fi first
#define se second
#define arr1d(a,n) cout << #a << " : "; fr(_,1,n) cout << a[_] << ' '; cout << endl;
#define arr1d0(a,n) cout << #a << " : "; rep(_,n) cout << a[_] << ' '; cout << endl;
#define arr2d(a,n,m) cout << #a << " :" << endl; fr(_,1,n) {fr(__,1,m) cout << a[_][__] << ' '; cout << endl;}
#define arr2d0(a,n,m) cout << #a << " :" << endl; rep(_,n) {rep(__,m) cout << a[_][__] << ' '; cout << endl;}

# define INF 1000000000000000
const int dx[]={0,0,-1,1},dy[]={-1,1,0,0};

using namespace std;
//gcd
ll Gcd(ll a,ll b){
	if(a%b==0) return b;
	return Gcd(b,a%b);
}
//max
ll Max(ll a,ll b){
	if(a>b)
	return a;
	return b;
}
//min
ll Min(ll a,ll b){
	if(a<b)
	return a;
	return b;
}

void printvector(std::vector<ll> v){  for (int i = 0; i < v.size(); ++i){cout<<v[i]<<" ";}cout<<""<<endl;}
void printarray(int a[],int n){for (int i = 0; i < n; ++i){cout<<a[i]<<" ";}cout<<""<<endl;}

ll findlcm(vector<ll> arr, ll n)
{
    // Initialize result
    ll ans = arr[0];

    // ans contains LCM of arr[0], ..arr[i]
    // after i'th iteration,
    for (int i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (Gcd(arr[i], ans)));

    return ans;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

 ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll modInverse(ll a, ll m)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    if (g != 1)
        return -1 ;
    else
    {

        ll res = (x%m + m) % m;
        return res;
    }
}

vector<ll> primeFactors(ll n)
{
    vector<ll> v;
	while (n%2 == 0)
	{
		v.push_back(2);
		n = n/2;
	}
	for (int i = 3; i <= sqrt(n); i = i+2)
	{
		while (n%i == 0)
		{
			v.push_back(i);
			n = n/i;
		}
	}

	if (n > 2)
		v.push_back(n);
		return v;
}

ll C[2001][2000];

void binomialCoeff(ll n, ll k)
{

    ll i, j;

    // Caculate value of Binomial Coefficient in bottom up manner
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= k; j++)
        {
            // Base Cases
            if (j == 0 || j == i)
                C[i][j] = 1;

            // Calculate value using previosly stored values
            else
                C[i][j] = (C[i-1][j-1]%MOD + C[i-1][j]%MOD)%MOD;
        }
    }

    //return C[n][k];
}

ll spf[MAXN];

void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)
      spf[i] = i;
   for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
           for (int j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

ll binarySearch(ll arr[], ll l, ll r, ll x)
{
   if (r >= l)
   {
        ll mid = l + (r - l)/2;
        if (arr[mid] == x)
            return mid;

        if (arr[mid] > x)
            return binarySearch(arr, l, mid-1, x);

        return binarySearch(arr, mid+1, r, x);
   }

   return -1;
}

//Segment Tree Implementation

          const ll N = 100000;

ll n;

           ll tree[2 * N];

void build( ll arr[])
{
    for (ll i=0; i<n; i++)
        { tree[n+i] = arr[i];

	     }

    for (ll i = n - 1; i > 0; --i)
        {tree[i] = tree[i<<1] + tree[i<<1 | 1];
              /* cout<<"i<<1  is "<<(i<<1)<<endl;
               cout<<"i<<1 | 1  is "<<(i<<1 | 1)<<endl;*/
	     }
}

void updateTreeNode(ll p, ll value)
{
    tree[p+n] = value;
    p = p+n;

    for (ll i=p; i > 1; i >>= 1)
        {tree[i>>1] = tree[i] + tree[i^1];
	       }
}

ll query(ll l, ll r)
{
    ll res = 0;

    for (l += n, r += n; l < r; l >>= 1, r >>= 1)
    {
        if (l&1)
           {
			   res += tree[l++];

               }
        if (r&1)
             {   res += tree[--r];

            }
    }

    return res;
}

//Dijkstra's Algorithm

vector<ll> shortPath( vector<pair<ll,ll> > v[],ll src,ll V=0)
{
     set< pair<ll,ll> > setds;

    ll sizee=V;
    ll IN=0x3f3f3f3f;
    vector<ll> dist(sizee, IN);

    setds.insert(make_pair(0, src));
    dist[src] = 0;

    while (!setds.empty())
    {
        pair<ll, ll> tmp = *(setds.begin());
        setds.erase(setds.begin());

        ll u = tmp.second;

        vector< pair<ll, ll> >::iterator i;
        for (i = v[u].begin(); i != v[u].end(); ++i)
        {
            ll v = (*i).first;
            ll weight = (*i).second;
      if (dist[v] > dist[u] + weight)
            {
                if (dist[v] != INF)
                    setds.erase(setds.find(make_pair(dist[v], v)));

                dist[v] = dist[u] + weight;
                setds.insert(make_pair(dist[v], v));
            }
        }
    }
    return dist;
}

struct DSU
{
	ll connected, left[N], right[N];
	ll par[N], sz[N];

	void init(ll n)
	{
		for(ll i=1;i<=n;i++)
		{
			par[i]=i;
			sz[i]=1;
			left[i]=i;
			right[i]=i;
		}
		connected=n;
	}

	ll getPar(ll k)
	{
		while(k!=par[k])
		{
			par[k]=par[par[k]];
			k=par[k];
		}
		return k;
	}

	ll getSize(ll k)
	{
		return sz[getPar(k)];
	}

	void unite(ll u, ll v)
	{
		ll par1=getPar(u), par2=getPar(v);

		if(par1==par2)
			return;

		connected--;

		if(sz[par1]>sz[par2])
			swap(par1, par2);

		sz[par2]+=sz[par1];
		sz[par1]=0;
		par[par1]=par[par2];
	}
};

ll dsu[100005];
ll fpar(ll i)
{
	return (dsu[i]<0)?i:dsu[i]=fpar(dsu[i]);
}
void merge(ll i, ll j)
{
	if((i=fpar(i))!=(j=fpar(j)))
	{
		if(dsu[i]>dsu[j])
			swap(i,j);
		dsu[i]+=dsu[j];
		dsu[j]=i;
	}
}

// Sieve Implementation
/*
for (ll i=2;i<=100005;i++)
        if (p[i]==0)
        for (ll j=2*i;j<=100005;j+=i) p[j]=1; */

// Dfs search

void dfs(std::vector<ll> v[],ll s,bool visited[])
{
	visited[s]=true;
  for (ll i = 0; i < v[s].size(); ++i)
  {
  	if(!visited[v[s][i]] )
  	{
  		dfs(v,v[s][i],visited);

  	}

  }

}

//do not use n , N , C

// Using iterators in C++
//set<ll>:: iterator it;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
cin>>n;
ll k;
cin>>k;
ll a,b;
cin>>a>>b;
ll p=0;
ll ref=a;
ll x=INF;
ll y=-1;
fr(i,1,n){
  p+=k;
  //p-=b;
  ll psu=p-b;
  ll d=psu-ref;
  /* if(i==1)*/
  //cout<<1<<" ";debug(d);
  ll gcd=Gcd(d,n*k);
  ll aa=Gcd(d,gcd);
  ll aka=d/aa;
  ll rem=gcd/aa;
  ll bka=(n*k)/rem;
  rem=gcd/rem;
  /* x=Min(((aka*bka)/rem),x);
  y=Max(((aka*bka)/rem),y); */
  x=Min(((n*k)/Gcd(d,n*k)),x);
  y=Max(((n*k)/Gcd(d,n*k)),y);
  //dbug(x); debug(y);
  psu+=2*b;
  d=psu-ref;
   gcd=Gcd(d,n*k);
  aa=Gcd(d,gcd);
   aka=d/aa;
   rem=gcd/aa;
 bka=(n*k)/rem;
/* x=Min(((aka*bka)/rem),x);
  y=Max(((aka*bka)/rem),y);
 */ //cout<<1<<" ";debug(d);
  x=Min(((n*k)/Gcd(d,n*k)),x);
  y=Max(((n*k)/Gcd(d,n*k)),y);
//dbug(x); debug(y);
}
ref=-a;
p=0;
fr(i,1,n){
  p+=k;
  //p-=b;
  ll psu=p-b;
  ll d=psu-ref;
  ll gcd=Gcd(d,n*k);
  ll aa=Gcd(d,gcd);
  ll aka=d/aa;
  ll rem=gcd/aa;
  ll bka=(n*k)/rem;
  rem=gcd/rem;
/*   x=Min(((aka*bka)/rem),x);
  y=Max(((aka*bka)/rem),y);
 */ //cout<<2<<" "; debug(d);
  x=Min(((n*k)/Gcd(d,n*k)),x);
  y=Max(((n*k)/Gcd(d,n*k)),y);
 //dbug(x); debug(y);
  psu+=2*b;
  d=psu-ref;
   gcd=Gcd(d,n*k);
  aa=Gcd(d,gcd);
   aka=d/aa;
   rem=gcd/aa;
 bka=(n*k)/rem;
/* x=Min(((aka*bka)/rem),x);
  y=Max(((aka*bka)/rem),y);
 *//* cout<<2<<" "; debug(d);  */
 x=Min(((n*k)/Gcd(d,n*k)),x);
  y=Max(((n*k)/Gcd(d,n*k)),y);
//dbug(x); debug(y);

}

cout<<x<<" "<<y<<endl;
 return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfi(x) scanf("%d" , &x)
#define sfi2(x, y) scanf("%d%d" , &x,&y)
#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)
#define sfl(x) scanf("%I64d" , &x)
#define sfl3(x, y, z) scanf("%I64d%I64d%I64d", &x, &y, &z)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf", &x, &y)
#define sfs(x) scanf("%s", &x)
#define testv(x) cerr << x << ' '
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define test cerr << "here"
#define fst(x) cout << fixed << setprecision(x)
#define mod 998244353
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;

int main()
{
    ll n, k, a, b;
    cin >> n >> k >> a >> b;
    vector<ll> v, st, en;
    for (ll i = 1; i <= n * k; i += k)
        v.push_back(i);
    for (auto it: v)
    {
        if (it + a > n * k)
            st.push_back(it + a - n * k);
        else
            st.push_back(it + a);
        if (it + b > n * k)
            en.push_back(it + b - n * k);
        else
            en.push_back(it + b);
        if (it - a < 1)
            st.push_back(it - a + n * k);
        else
            st.push_back(it - a);
        if (it - b < 1)
            en.push_back(it - b + n * k);
        else
            en.push_back(it - b);
    }
    ll maxi = -4e18;
    ll mini = 4e18, lcm, l;
    for (int i = 0; i < en.size(); i++)
    {
        if (en[i] == st[0])
        {
            mini = min(mini, (ll)1);
            maxi = max(maxi, (ll)1);
            continue;
        }
        if (en[i] < st[0])
            l = n * k - st[0] + en[i];
        else
            l = en[i] - st[0];
        lcm = n * k / __gcd(l, n * k);
        mini = min(mini, lcm);
        maxi = max(maxi, lcm);
        if (en[i] > st[0])
            l = n * k + st[0] - en[i];
        else
            l = -en[i] + st[0];
        lcm = n * k / __gcd(l, n * k);
        mini = min(mini, lcm);
        maxi = max(maxi, lcm);
    }
    cout << mini << ' ' << maxi;
    return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <string>
#include <map>
#include <iostream>
#include <functional>
#include <algorithm>
#include <set>
#include <memory>

using namespace std;

typedef long long i64;
typedef unsigned long long u64;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define R(x) x.begin(),x.end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef pair<i64, i64> pll;
typedef vector<pll> vll;

i64 gcd( i64 a, i64 b )
{
    while ( b )
    {
        i64 t = a % b;
        a = b;
        b = t;
    }
    return a;
}

int main()
{
    i64 n, k, a, b;
    cin >> n >> k >> a >> b;
    auto len = n * k;
    auto mn = numeric_limits<i64>::max(), mx = numeric_limits<i64>::min();
    for ( auto p0 : { -a, a } )
    {
        for ( i64 d = 0; d < n; ++d )
        {
            for ( auto p1 : { d * k - b, d * k + b } )
            {
                auto l = ( p1 + len - p0 ) % len;
                if ( !l ) l = len;
                i64 t = len / gcd( l, len );
                mn = min( mn, t );
                mx = max( mx, t );
            }
        }
    }
    cout << mn << " " << mx;
    return 0;
}

#include <bits/stdc++.h>

#define fastio iostream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

long long __gcd(long long a, long long b){
  if (b == 0) return a;
  return __gcd(b, a % b);
}

int main(){
  fastio;

  long long n, m; cin >> n >> m;
  long long s, l; cin >> s >> l;
  long long numcity = n * m;

    vector<long long> cities = {0, m, (2 * m) % numcity};
    set<long long> poss, posl;

    for (auto c : cities){
      long long p = c + s;
      if (p >= numcity) p -= numcity;
      if (p < 0) p += numcity;
      poss.insert(p);

      p = c - s;
      if (p >= numcity) p -= numcity;
      if (p < 0) p += numcity;
      poss.insert(p);

      p = c + l;
      if (p >= numcity) p -= numcity;
      if (p < 0) p += numcity;
      posl.insert(p);

      p = c - l;
      if (p >= numcity) p -= numcity;
      if (p < 0) p += numcity;
      posl.insert(p);
    }

    set<long long> dist;
    for (auto ps : poss)
      for (auto pl : posl)
        dist.insert(abs(ps - pl));

    long long ans_min = 1000000000000000000;
    long long ans_max = INT_MIN;

    for (auto el : dist){
      if (el == 0) el = m;
      long long t = el;

      while (el > 0 && t <= numcity){
        long long tempans = numcity / __gcd(t, numcity);
        if (tempans > 0) ans_min = min(ans_min, tempans);
        if (tempans > 0) ans_max = max(ans_max, tempans);
        t += m;
      }
    }

    cout << ans_min << " " << ans_max << endl;

  return 0;
}

#include <bits/stdc++.h>
#include<limits.h>
using namespace  std;
typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define filla(a,k,n) memset(a,k,sizeof(a[0])*n)
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
const ll N=1000005;
v64 v;
v64 pq;
ll c[100005],root;
int main()
{
    ll n,k,max1=0,min1,i,j,a,b;
    cin>>n>>k;
    cin>>a>>b;
    ll d[2],c[4];
    d[0]=1+a;
    d[1]=k+1-a;
    c[0]=1+b;
    c[1]=k+1-b;
    c[2]=1+k+b;
    c[3]=1+2*k-b;
    min1=1e18;
    max1=0;
    for(i=0;i<4;i++)
    {
        for(j=0;j<2;j++)
        {
            ll g;
            if(c[i]>=d[j])
            {
                ll l,r;
                for(l=c[i];l<=d[j]+n*k;l+=k)
                {
                    if(c[i]==d[j])
                    {
                        min1=1;
                        max1=1;
                    }
                    else
                    {
                        ll m=__gcd(l-d[j],n*k);
                        max1=max(max1,n*k/m);
                        min1=min(min1,n*k/m);
                    }
                }
            }
        }
    }
    j=1;
    cout<<min1;
    sp;
    cout<<max1;

}

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#pragma warning (disable:4996)
typedef long long int LL;
LL nk;
LL gcd(LL y)
{
	LL a = nk, b = y, c;
	if (!b)
	{
		b = a;
		return (1);
	}
	while (c = a % b)
	{
		a = b;
		b = c;
	}
	return nk / b;
}
int main()
{
	int n, k, a, b;
	LL x = 1e18, y = -1;
	scanf("%d%d%d%d", &n, &k, &a, &b);
	nk = LL(n)*LL(k);
	LL f[4] = {
		((k + b) - a) % k,
		((k + b) - (k - a)) % k,
		((2 * k - b) - a) % k,
		((2 * k - b) - (k - a)) % k
	};
	LL c, cnt = 0;
	for (int i = 0; i <= n; ++i)
	{
		cnt += k;
		if (cnt + f[0] > 0)
		{
			c = gcd(cnt + f[0]); x = min(x, c); y = max(y, c);
		}
		if (cnt + f[1] > 0)
		{
			c = gcd(cnt + f[1]); x = min(x, c); y = max(y, c);
		}
		if (cnt + f[2] > 0)
		{
			c = gcd(cnt + f[2]); x = min(x, c); y = max(y, c);
		}
		if (cnt + f[3] > 0)
		{
			c = gcd(cnt + f[3]); x = min(x, c); y = max(y, c);
		}
	}
	cout << x << ' ' << y << '\n';
}

#include <algorithm>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <string>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <ctime>
#include <set>
#include <map>

using namespace std;

typedef int64_t ll;
typedef long double ld;

inline void start() {
#ifdef BOKU_NO_PICO
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
#endif
}

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

inline void solve() {
    ll n, k;
    cin >> n >> k;
    ll a, b;
    cin >> a >> b;
    ll mn = 1e11;
    ll mx = -1e11;
    for (ll i = 1; i <= n; ++i) {
        ll l = i * k - a - b;
        mn = min(mn, n * k / gcd(n * k, l));
        mx = max(mx, n * k / gcd(n * k, l));
    }
    for (ll i = 1; i <= n; ++i) {
        ll l = i * k - a + b;
        mn = min(mn, n * k / gcd(n * k, l));
        mx = max(mx, n * k / gcd(n * k, l));
    }
    for (ll i = 0; i <= n; ++i) {
        ll l = i * k + a + b;
        mn = min(mn, n * k / gcd(n * k, l));
        mx = max(mx, n * k / gcd(n * k, l));
    }
    cout << mn << " " << mx << endl;
}

int32_t main() {
    start();
    solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define SZ(x) ((int)(x).size())
#define PB(x) push_back(x)
#define MEMSET(x,v) memset(x,v,sizeof(x))
#define REP(i,n) for(int i=0;(i)<(n);++(i))
#define x first
#define y second
#define INF (0x3f3f3f3f)

typedef long long LL;
typedef pair<int, int> P2;
template<class A, class B> inline bool mina(A &x, B y) {return (x > y)?(x=y,1):0;}
template<class A, class B> inline bool maxa(A &x, B y) {return (x < y)?(x=y,1):0;}

LL N, K;
LL A, B;
LL ans_max, ans_min;

int mygcd(int a, int b) {
    if (b == 0) return a;
    return mygcd(b, a % b);
}

void solve2(LL start, LL first_stop) {
    LL l;
    if (start == first_stop) {
        l = N * K;
    } else {
        l = first_stop - start + N * K;
        l %= N * K;
    }
    LL x = N * K / gcd(N * K, l);
    mina(ans_min, x);
        maxa(ans_max, x);
    }

void solve(LL start) {
    REP(i, N) {
        solve2(start, (K * i + B) % (N * K));
        solve2(start, (K * i + B) % (N * K));
    }
}

int main() {
    ans_min = (1LL<<62);
    ans_max = 0;
    cin >> N >> K;
    cin >> A >> B;
    solve(A);
    solve(N * K - A);
    cout << ans_min << " " << ans_max;
    return 0;
}

//This is easiest

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define f first
#define s second
#define pb push_back

ll my_gcd(ll x,ll y)
{
    if(x-y*(x/y)==0)return y;
    else return my_gcd(y,(x-y*(x/y)));
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);
    int Tes = 1;
    while(Tes--)
    {
         ll n,m;
         cin >> n >> m;
         ll k=m;
         ll a,b;
         ll c =0;
         ll mn_step=1e18,mx_step=-1e18;
         cin >> a >> b;
         //ll d[0][0]=a,d[0][1]=(k-a-1),d[1][0]=b,d[1][1]=(k-b-1);
         ll len[40];len[0]=(b-a),len[1]=((k-b)-a),len[2]=(b-(k-a)),len[3]=((k-b)-(k-a));
         if(n==1)
         {
             ll l_n = ((k-b)-a);
             ll lcm = (k*l_n)/(__gcd(k,l_n));
             ll step_=lcm/l_n;
             cout<<step_<< ' '<<step_<<endl;return 0;
         }
         for(ll i = 0;i<=n;i++)
         {
             for(ll l_n=0;l_n<=3;l_n++)
             {
                 ll x = k*i+len[l_n];

                 if(x<=0)continue;

                 ll gcd  = (__gcd(x,(n*k)));
                 ll step_=(n*k)/gcd;

                 mn_step=min(step_,mn_step);
                 mx_step=max(mx_step,step_);
             }
         }
         //if(c)cout<<1;else cout<<mn_step;
         cout<<mn_step<<' '<<mx_step<<endl;
    }
}

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#include <bits/stdc++.h>

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef vector < int > VI;
typedef double D;

const int MN = 100005, inf = 1000000005, mod = 1000000007;
const LL INF = 1000000000000000005LL;

LL n, k, mini = INF, maxi;

LL przed(LL x, LL odl)
{
	x -= odl;
	if(x < 0)
		x += n * k;
	return x;
}

LL po(LL x, LL odl)
{
	x += odl;
	if(x >= n * k)
		x -= n * k;
	return x;
}

int main()
{
	LL a, b;
	set < LL > pie, dru;
	scanf("%lld%lld", &n, &k);
	scanf("%lld%lld", &a, &b);
	LL cur = 0LL;
	for(int i = 1; i <= n; ++i)
	{
		dru.insert(przed(cur, b));
		dru.insert(po(cur, b));
		cur += k;
	}
	LL x = n * k;
	for(auto xd : dru)
	{
		LL d = abs(xd - a);

		{
			mini = min(mini, x / __gcd(x, d));
			maxi = max(maxi, x / __gcd(x, d));
		}

		d = abs((k - a) - xd);

		{
			mini = min(mini, x / __gcd(x, d));
			maxi = max(maxi, x / __gcd(x, d));
		}
	}
	printf("%lld %lld", mini, maxi);
}

#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>

typedef long long LL;

int readInt() {
  int ans = 0, c, f = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') f *= -1;
  do ans = ans * 10 + c - '0';
  while (isdigit(c = getchar()));
  return ans * f;
}

LL n, k, minv, maxv;

void qwq(int a, int b) {
  int v = b - a;
  if (v < 0) v = -v;
  for (int i = 0; i < n; ++i) {
    LL ans = n * k / std::__gcd(n * k, i * k + v);
    minv = std::min(minv, ans);
    maxv = std::max(maxv, ans);
  }
}

int main() {
  int a, b;
  scanf("%I64d%I64d%d%d", &n, &k, &a, &b);
  maxv = 0;
  minv = 0x7fffffffffffffffLL;
  qwq(a, b);
  qwq(a, -b);
  printf("%I64d %I64d\n", minv, maxv);
}

#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <chrono>
#define FOR(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %ld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

const int MAXN = 100100;

int n, k, a, b;
ll m;

ll gcd (ll a, ll b) {
	if (b == 0) return a;
	return gcd (b, a % b);
}

ll lcm (ll a_, ll b_) {
	ll c = gcd (a_, b_);
	return a_ * b_ / c;
}

void load() {
	scanf("%d%d%d%d", &n, &k, &a, &b);
}

ll cyc (ll x) {
	while ( x < 0 ) x += m;
	return x % m;
}

vector<ll> ss;

ll x, y;

void solve1(ll s) {
	for (ll kand : ss) {
		ll cyc_ = cyc (kand - s);
		if (cyc_ == 0) cyc_ = m;
		//printf("cyc: %lld\n", cyc_);
		ll kor = m / gcd (m, cyc_);
		//printf("%lld %lld %lld\n", s, kand, kor);
		x = min (x, kor);
		y = max (y, kor);
	}
}

void solve() {
	y = 0, x = 2e18;
	m = (ll) n * k;
	for (ll i = 0; i < m; i += k) {
		ll pret = cyc (i - b), nex = cyc (i + b);
		ss.push_back (pret);
		ss.push_back (nex);
	}
	ll pret = cyc (0 - a), nex = cyc (0 + a);
	solve1 (pret); solve1 (nex);
	printf("%lld %lld\n", x, y);
}

int main() {
	load();
	solve();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
constexpr int N=1e5+10;
long long n,k,a,b;
long long calc(long long l){
    return (1ll*n*k/__gcd(1ll*n*k,l));
}
long long dist(long long x, long long y){
    return (y>x?y-x:n*k-x+y);
}

int main(){
    scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
    long long pos=1+a;
    if(pos>n*k) pos-=n*k;
    long long mn=1e18, mx=-1;
    for(long long i=1+b,j=0;j<=n;i+=k,j++){
        if(i>n*k) i-=n*k;
        mn=min(mn,calc(dist(pos,i)));
        mx=max(mx,calc(dist(pos,i)));
    }
    for(long long i=1-b,j=0;j<=n;i+=k,j++){
        if(i>n*k) i-=n*k;
        if(i<=0) i+=n*k;
        mn=min(mn,calc(dist(pos,i)));
        mx=max(mx,calc(dist(pos,i)));
    }
    pos=1-a;
    if(pos<=0) pos+=n*k;
    for(long long i=1-b,j=0;j<=n;i+=k,j++){
        if(i>n*k) i-=n*k;
        if(i<=0) i+=n*k;
        mn=min(mn,calc(dist(pos,i)));
        mx=max(mx,calc(dist(pos,i)));
    }
    for(long long i=1+b,j=0;j<=n;i+=k,j++){
        if(i>n*k) i-=n*k;
        mn=min(mn,calc(dist(pos,i)));
        mx=max(mx,calc(dist(pos,i)));
    }
    printf("%lld %lld\n",mn,mx);
    return 0;
}

//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<assert.h>
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<bitset>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef pair <ll,ll> PLL;
typedef unsigned int uint;
#define all(x) (x).begin(), (x).end()
#define rep(i,j,k) for(int (i)=(j);(i)<(k);++i)
#define drp(i,j,k) for(int (i)=(j);(i)>=(k);--i)
#define sz(x) (int)(x).size()
const int MOD=1e9+7;
const ll LL_INF= 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;

inline void cmin(int &x,int y){if(y<x)x=y;}
inline void cmax(int &x,int y){if(y>x)x=y;}

int main(){

	ll n,k,a,b;
	scanf("%I64d %I64d %I64d %I64d",&n,&k,&a,&b);
	ll mn=LL_INF,mx=-1;

	for(ll i=0;i<2;i++)
		for(ll j=0;j<2;j++){
			ll s=a;
			if(i)s=k-a;

			ll e=b;
			if(j)e=k-b;

			ll x=(e-s+k)%k;
			for(ll i=0;i<n;i++){
				ll v=__gcd(n*k,x+k*i);
				mn=min(mn,n*k/v);
				mx=max(mx,n*k/v);

			}

		}

	printf("%I64d %I64d",mn,mx);

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld INF = 1e18;

lld x = INF;
lld y = 0;
lld n,k;
lld d;

lld rep(lld o){
	while(o < 0)
		o += k;
	o %= k;

	return o;
}

void check(lld p, lld q){
	p = rep(p), q = rep(q);
	lld l = (q-p == 0 ? k : (p-q+(2*k))%(2*k));

	for(lld i=l;i<=d;i+=k){
		x = min(x, d/__gcd(d,i));
		y = max(y, d/__gcd(d,i));
	}
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	lld a,b;

	cin >> n >> k >> a >> b;
	d = n*k;

	check(a, b);
	check(a, k-b);
	check(k-a, b);
	check(k-a, k-b);

	cout << x << " " << y << "\n";

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define mod 1000000007
template<class T>
void printQueue(T& q)
{while (!q.empty()){cout << q.top() << endl;q.pop();}}

ll power(ll a,ll b)
{
    ll r=1;
    while(b!=0)
    {
        if(b%2!=0){r=r*a;}
        a=a*a; b=b/2;
    }
    return r;
}

int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;

        ll a,b;
        cin>>a>>b;

        vector<ll> astha;
        unordered_map<ll,int> piz;
        for(ll i=1;i<=(n*k);i=i+k)
        {
            if((i+b)<=(n*k)){ if(piz.find(i+b)==piz.end()){astha.pb(i+b); piz[i+b]=1;} }
            else{ if(piz.find(i+b-(n*k))==piz.end()){astha.pb(i+b-(n*k)); piz[i+b-(n*k)]=1;} }

            if(i>b){ if(piz.find(i-b)==piz.end()){astha.pb(i-b); piz[i-b]=1;} }
            else{ if(piz.find(n*k+i-b)==piz.end()){astha.pb((n*k)+i-b); piz[(n*k)+i-b]=1;} }
        }

        ll first,second,steps,lcm,vals,moves;
        vals=n*k;
        ll maxm_moves=0,minm_moves=1e18;
        if(a==0)
        {
            first=1;

            for(int i=0;i<astha.size();i++)
            {
                steps=abs(first-astha[i]);
                if(steps==0){moves=1;}
                else
                {
                    lcm=__gcd(vals,steps);
                    moves=vals/lcm;
                }

                maxm_moves=max(maxm_moves,moves);
                minm_moves=min(minm_moves,moves);
            }
        }
        else
        {
            first=1+a; second=1+n*k-a;
            //cout<<"DAS"<<endl;
            for(int i=0;i<astha.size();i++)
            {
                steps=abs(first-astha[i]);
                if(steps==0){moves=1;}
                else
                {
                    lcm=__gcd(vals,steps);
                    moves=vals/lcm;
                }

                maxm_moves=max(maxm_moves,moves);
                minm_moves=min(minm_moves,moves);
                //cout<<steps<<" "<<moves<<endl;
            }

            for(int i=0;i<astha.size();i++)
            {
                steps=abs(second-astha[i]);
                if(steps==0){moves=1;}
                else
                {
                    lcm=__gcd(vals,steps);
                    moves=vals/lcm;
                }

                maxm_moves=max(maxm_moves,moves);
                minm_moves=min(minm_moves,moves);
            }
        }

        cout<<minm_moves<<" "<<maxm_moves<<endl;
    }
}

/*
 * shubhamg931 - Shubham Gupta (B.Tech - IT, 2016-2020 batch)
*/

#include<bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define MAXN 500005
#define PI 3.14159265
#define pb push_back
#define eb emplace_back
#define FILE_READ freopen("input.txt","r",stdin)
#define FILE_WRITE freopen("output.txt","w",stdout)
#define mp(a,b) make_pair(a,b)
#define mset(arr,val) memset(arr,val,sizeof arr)
#if 1
typedef long long let;
#else
typedef int let;
#endif
typedef unsigned long long ull;
typedef long ld;
typedef long double ldo;
typedef pair<let, let> pll;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    let n,k,i,a,b;
    cin>>n>>k;
    cin>>a>>b;
    set<let> startSet;
    let num1, num2;
    num1 = 1 + a;
    num2 = 1 - a;
    if(num2 <= 0)
        num2 += (n*k);
    startSet.insert(num1);
//    startSet.insert(num2);

    set<let> endSet;
    for(i=0;i<n;++i){
        num1 = (i*k + 1) + b;
        num2 = (i*k + 1) - b;
        if(num2 <= 0)
            num2 += (n*k);

        endSet.insert(num1);
        endSet.insert(num2);
    }

    let minAns = LLONG_MAX, maxAns = LLONG_MIN;

    for(auto it: startSet){
        for(auto itr: endSet){
            let a1 = itr - it;
            if(a1 <= 0){
                a1 += n*k;
            }
//            cout<<"a1: "<<a1<<endl;
            let g = __gcd(a1, n*k);
            let rounds = (n*k)/g;
            minAns = min(minAns, rounds);
            maxAns = max(maxAns, rounds);
        }
    }
    cout<<minAns<<" "<<maxAns;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define rep(i,a,r) for(int i=a;i<r;i++)
#define mod 1000000007
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	ll n,k,a,b;
	cin>>n>>k>>a>>b;
	ll x=100000000000000,y=LONG_MIN;
	for(int i=0;i< (n+1)/2;i++)
    {
        ll l=abs(a+ i*k -b);
        if(l==0) l=n*k;
        x=min(x,(n*k)/__gcd(n*k,l));
        y=max(y,(n*k)/__gcd(n*k,l));
        l=abs(a+ i*k +b);
        x=min(x,(n*k)/__gcd(n*k,l));
        y=max(y,(n*k)/__gcd(n*k,l));
        l=abs(k-a+ i*k -b);
        x=min(x,(n*k)/__gcd(n*k,l));
        y=max(y,(n*k)/__gcd(n*k,l));
        l=abs(k-a+ i*k +b);
        x=min(x,(n*k)/__gcd(n*k,l));
        y=max(y,(n*k)/__gcd(n*k,l));
    }
    cout<<x<<' '<<y<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test() long long int t; cin >> t; cin.ignore(); while(t--)
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define mod(n) (((n%MOD)+MOD)%MOD)

int main(){
	ll n, k, a, b;
	cin >> n >> k >> a >> b;
	ll x[4]={a+b, a-b, b-a, -a-b};
	ll mn=1e18, mx=-1;
	for(ll i=0; i<=n; i++){
		for(ll j=0; j<4; j++){
			if( (i*k+x[j])>(ll)0 ){
				ll cnt = (n*k)/__gcd(n*k, x[j]+i*k) ;
				mx = max(cnt, mx);
				mn = min(cnt, mn);
			}
		}
	}
	cout << mn << " " << mx << endl;
}

#include <bits/stdc++.h>
using namespace std;
//mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count());
//int rnd(int x) { return mrand()%x;}
typedef long long ll;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int main(){
	ll n,k,a,b;
	scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
	vector<ll> v;
	v.push_back((b-a+k)%k);v.push_back((k-b-a+k)%k);v.push_back((b-k+a+k)%k);v.push_back((a-b+k)%k);
	ll mi=1e18,ma=-1;
	for(int x:v){
		if(x==0) x=k;
		ll lcm=1ll*x*k/gcd(x,k);
		ll c=lcm/x,cc=lcm/k;
		//ll cmi=1e18,cma=-1;
		for(int i=0;i<n;i++){
			ll tmp=1ll*i*c+cc;
			if((tmp%n)==0){
				mi=min(mi,c);
				ma=max(ma,1ll*c);
			}
			else{
				mi=min(mi,1ll*c*n/gcd(tmp%n,n));
				ma=max(ma,1ll*c*n/gcd(tmp%n,n));
			}
		}
	}
	printf("%lld %lld\n",mi,ma);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000000000000
#define clr(arr) memset((arr),0,(sizeof(arr)))
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define REP(qqq,n) for(int (qqq)=0;(qqq)<(n);(qqq)++)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
# define mod (1000000007)
#define asz 500005
ll gcd(ll x,ll y)
{
    if(y==0)return x;
    return gcd(y,x%y);
}
int main()
{
    fastread;
    int T=1;
//    cin>>T;
    for(int qq=1;qq<=T;qq++)
    {
        ll n,k;
        cin>>n>>k;
        ll a,b;
        cin>>a>>b;
        ll mx=0,mn=INF;
        for(ll i=0;i<n;i++)
        {
            ll l=k*i+a+b;
            ll x=gcd(n*k,l);
            mx=max(mx,(n*k)/x),mn=min(mn,(n*k)/x);
            l=abs(-a+k*i+b);
            x=gcd(n*k,l);
            mx=max(mx,(n*k)/x),mn=min(mn,(n*k)/x);
            l=abs(a+k*i-b);
            x=gcd(n*k,l);
            mx=max(mx,(n*k)/x),mn=min(mn,(n*k)/x);
            l=abs(-a+k*i-b);
            x=gcd(n*k,l);
            mx=max(mx,(n*k)/x),mn=min(mn,(n*k)/x);
        }
        cout<<mn<<' '<<mx<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main() {
    ll n, k;
    ll a, b;
    ll x, y;

    ll l;
    cin >> n >> k >> a >> b;

	set<ll> v;

	for(ll q = 0; q <= n; q++)
	{
	    l = (q * k + a - b);
	    if(l > a)
	        v.insert(l % (n * k));
	}

	for(ll q = 0; q <= n; q++)
	{
	    l = (q * k + a + b);
	    if(l > a + b)
	        v.insert(l % (n * k));
	}

	for(ll q = 0; q <= n; q++)
	{
	    l = (q * k - a + b);
	    if(l > b)
	        v.insert(l % (n * k));
	}

	for(ll q = 0; q <= n; q++)
	{
	    l = (q * k - a - b);
	    if(l > 0)
	        v.insert(l % (n * k));
	}

	v.insert(abs(a - b));
	if(a==b)v.insert(0);
	if(a==0)v.insert(b);
	if(b==0)v.insert(a);
	v.insert((a+b)%(n*k));

	ll max=-n*k,min=n*k;

	for(auto i:v){
	    if(i==0)i=n*k;
	    ll ans = (n*k)/gcd((n*k),i);
	    if(ans>max)max=ans;
	    if(ans<min)min=ans;
	}

	cout << min << " " << max;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
///// This part below is only for debug, not used /////
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
///// END /////
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds; // find_by_order(), order_by_key()
template<typename TK> using pbds_set = tree<TK, null_type, less<TK>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename TK, typename TV> using pbds_map = tree<TK, TV, less<TK>, rb_tree_tag, tree_order_statistics_node_update>;
*/
lint N, K;
lint X, Y;
void solve(lint A, lint B, lint i)
{
    lint diff = (B + K * i - A + N * K) % (N * K);
    if (diff)
    {
        lint g = __gcd(N * K, diff);
        lint ret = N * K / g;
        mmin(X, ret);
        mmax(Y, ret);
    }
    else mmin(X, 1LL);
}

int main()
{
    lint A, B;
    cin >> N >> K >> A >> B;
    X = N * K, Y = 1;
    REP(i, N)
    {
        solve(A, B, i + 1);
        solve(A, K - B, i + 1);
    }
    cout << X << " " << Y << endl;
}

#include <bits/stdc++.h>
#define endl '\n'
#define Long long long
#define forn(i, n) for(int i = 0; i < n; ++i)
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
using namespace std;

const int MAXN = 1e5;
const Long INF = (1LL << 62);

Long menor = INF;
Long mayor = - INF;

void prueba(Long inicio, Long n, Long k){
    Long T = n * k;
    inicio %= k;
    if(inicio < 0) inicio += k;

    while(inicio <= T){
        Long pasos = T / __gcd(inicio, T);
        menor = min(pasos, menor);
        mayor = max(pasos, mayor);

        inicio += k;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    Long n, k;
    cin >> n >> k;
    Long a, b;
    cin >> a >> b;

    prueba(a + b, n, k);
    prueba(a - b, n, k);
    prueba(-a + b, n, k);
    prueba(-a - b, n, k);

    cout << menor << " " << mayor << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define MAX 1e18
#define N 1005
ll mod2 = 998244353;
ll mod = 1e9 + 7;

ll n,k;

void solve()
{
  cin>>n>>k;
  ll a,b;
  cin>>a>>b;

  ll x = 1e15;
  ll y = 0;

  for(ll i = 0;i<=n;++i)
  {
    ll q= abs(i*k + b + a);
    ll w = abs(i*k - b - a);
    ll e = abs(i*k - b + a);
    ll r = abs(i*k +b - a);

    if(q)
    {
      ll lcm = (n*k/(__gcd(q,n*k)))*q;
      x = min(x,lcm/q);
      y = max(y,lcm/q);

    }

    if(w)
    {
      ll lcm = (n*k/(__gcd(w,n*k)))*w;
      x = min(x,lcm/w);
      y = max(y,lcm/w);

    }

    if(e)
    {
      ll lcm = (n*k/(__gcd(e,n*k)))*e;
      x = min(x,lcm/e);
      y = max(y,lcm/e);

    }

    if(r)
    {
      ll lcm = (n*k/(__gcd(r,n*k)))*r;
      x = min(x,lcm/r);
      y = max(y,lcm/r);

    }

  }

  cout<<x<<" "<<y;

}

int main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

ll t=1;
//cin>>t;

while(t--)
{
  solve();
}
return 0;

}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
	if(b==0)return a;
	ll t=b;
	b=a%b;
	a=t;
	ll ans = gcd (a,b) ;
	return ans;
}

int main() {
	ll n,k,a,b,x=1e18,y=0;
	cin>>n>>k>>a>>b;
	vector<ll> ans;
	ll s= 1+a;
	for (ll i=k;i<=n*k;i+=k){
		ll  l,lc;
		l=a+b+i;
		lc = n*k/ gcd (n*k,l);
		ans.push_back(lc);
		l=a-b+i;
		lc = n*k/ gcd(n*k,l);
		ans.push_back(lc);
	}
	// s= 1-a;
	// if(s<1){s+=n*k;}
	// for (int i=1;i<=n*k;i+=k){
	// 	ll ss = i+b,lc;
	// 	ll l= dist(s,ss);
	// 	if(l!=0){
	// 		lc = lcm (n*k,l)/l;
	// 	}else {lc=1;}
	// 	x=min(x,lc);
	// 	y=max(y,lc);
	// 	ss = i-b;
	// 	if(ss<1){ss+=n*k;}
	// 	l= dist(s,ss);
	// 	if(l!=0){lc = lcm (n*k,l)/l;}
	// 	else {lc=1;}
	// 	x=min(x,lc);
	// 	y=max(y,lc);
	// }
	sort(ans.begin(),ans.end());
	cout<<ans[0]<<" ";
	ll sz= ans.size()-1;
	cout<<ans[sz];
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
long long gcd(long long n1, long long n2)
{
    if (n2 != 0)
       return gcd(n2, n1%n2);
    else
       return n1;
}

int main()
{
    long long n,k,a,b;
    cin>>n>>k;
    cin>>a>>b;
    long long mi=n*k,ma=0,s1=a+b,s2=abs(a-b),l=n*k,r1,r2;
    for(long long i=0;i<n+1;i++)
    {
        if(s2)
        {
            r1=l/gcd(l,s2);
            if(r1<mi)
                mi=r1;
            if(r1>ma)
                ma=r1;
        }
        if(s1)
        {
            r1=l/gcd(l,s1);
            if(r1<mi)
            {   mi=r1; }
            if(r1>ma)
                ma=r1;
        }
        s1+=k;
        s2+=k;
    }
    cout<<mi<<" "<<ma;
    return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <string>
#include <map>
#include <iostream>
#include <functional>
#include <algorithm>
#include <set>
#include <memory>

using namespace std;

typedef long long i64;
typedef unsigned long long u64;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define R(x) x.begin(),x.end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef pair<i64, i64> pll;
typedef vector<pll> vll;

i64 gcd( i64 a, i64 b )
{
    while ( b )
    {
        i64 t = a % b;
        a = b;
        b = t;
    }
    return a;
}

int main()
{
    i64 n, k, a, b;
    cin >> n >> k >> a >> b;
    auto len = n * k;
    auto mn = numeric_limits<i64>::max(), mx = numeric_limits<i64>::min();
    for ( auto p0 : { -a, a } )
    {
        for ( i64 d = 0; d < n; ++d )
        {
            for ( auto p1 : { d * k - b, d * k + b } )
            {
                auto l = ( p1 + len - p0 ) % len;
                if ( !l ) l = len;
                i64 t = len / gcd( l, len );
                mn = min( mn, t );
                mx = max( mx, t );
            }
        }
    }
    cout << mn << " " << mx;
    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll inf=10000000010ll;
ll n,k,a,b,l,minn=inf,maxx=-inf;
ll gcd(ll x,ll y){return (x%y)?gcd(y,x%y):y;}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
	for(l=(a+b)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(a-b+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(-a+b+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	for(l=(-a-b+k+k)%k;l<=n*k;l+=k)if(l)minn=min(minn,n*k/gcd(l,n*k)),maxx=max(maxx,n*k/gcd(l,n*k));
	printf("%lld %lld\n",minn,maxx);
	return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

#define MAXN 100005

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

mt19937 g1(time(0));

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int num_food,K,a,b;
ll small=LLONG_MAX,large,full;

inline void solve(ll start, ll lstart){
    if(lstart == 0) lstart = full;
    for(ll i=lstart; i<=2LL*num_food*K; i+=K){
        ll len = ((i%full)-start+full)%full, num_moves = full/gcd(full,len);
        small = min(small,num_moves);
        large = max(large,num_moves);
    }
}

int main(){
    scanf("%d %d %d %d",&num_food,&K,&a,&b);
    full = (ll)num_food*K;
    ll start = a+1, lstart = K-b+1;
    solve(start,lstart);
    lstart = (K+b+1)%full;
    solve(start,lstart);

    start = (1LL-a+full)%full, lstart = (1LL-b+full)%full;
    solve(start,lstart);
    lstart = 1+b;
    solve(start,lstart);

    printf("%lld %lld\n",small,large);
}

#include <bits/stdc++.h>
using namespace std;
#define mid ((s + e) / 2)
long long M = 1e9 + 7;
#define int long long
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

int md(int a, int b) {
	return (((a % b) + b) % b);
}

int32_t main() {
	int n, k, a, b;
	cin >> n >> k >> a >> b;
	int p = a + 1;
	int mx = 0, mn = 1e18;
	for (int t = 1; t <= n; t++)
		for (int x = -b, cx = 0; cx < 2; cx++, x += 2 * b)
			for (int y = -a, cy = 0; cy < 2; cy++, y += 2 * a) {
				int tt = __gcd(t * k + x + y, n * k);
			   	tt = n * k / tt;
				mn = min(mn, tt);
				mx = max(mx, tt);
			}
	cout << mn << " " << mx << endl;
	return 0;
}

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long int ll;
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> PII;

const int mod = 1e9 + 7;

ll n,k;
ll a,b;

ll mv = -1;
ll mxv = -1;

void update(ll t)
{
    if(t<=0)return;

    ll pos = n*k / __gcd(n*k,t);
    if(mv==-1)mv=pos; else mv = min(mv,pos);
    if(mxv==-1)mxv=pos; else mxv = max(mxv,pos);

    // if(t<=0 || t>n*k)return;
    // if(n*k % __gcd(n*k,t) !=0 )return;
    // if(mv==-1)mv = __gcd(n*k,t); else mv = min(mv,__gcd(n*k,t));
    // if(mxv==-1)mxv = __gcd(n*k,t); else mxv = max(mv,__gcd(n*k,t));
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin>>n>>k;
  cin>>a>>b;

  for(ll c=0;c<n;c++)
  {
      ll t = c*k + b - a;
      update(t);
      t = c*k + a - b;
      update(t);
      t = c*k + a + b;
      update(t);
      t = c*k -a - b;
      update(t);
  }
  // ll t = a+b;
  // update(t);
  // t = a-b;
  // cout<<n*k/mxv<<" "<<n*k/mv<<endl;
  cout<<mv<<" "<<mxv<<endl;
  return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <memory.h>
#include <algorithm>
#define case        printf("Case %d: ",++tc);
#define read        freopen("tst.txt","r",stdin)
#define write       freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;
#define pi acos(-1)

vector<ll> v;

ll lcm(ll a,ll b){
    return (a*b)/__gcd(a,b);
}

main(){

ll n,k,a,b,T,x = 1e7,y = 0;

scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
T = n*k;
if(a==b)    x = 1;

for(ll i = 1; i<=n*k; i+=k)     v.push_back(i);

//for(ll i:v) cout<<i<<" ";
//cout<<endl;cout<<endl;

for(ll i = 0; i<v.size(); i++){
    ll d1,d2,p,q,s = 1+a;

    ll X = (v[i]-b+T)%T;
    ll Y = (v[i]+b+T)%T;
    d1 = abs(s-X);
    d2 = abs(s-Y);
    if(d1){
    p = lcm(T,d1)/d1;
    x = min(x,p);
    y = max(y,p);
    }
    if(d2){
    p = lcm(T,d2)/d2;
    x = min(x,p);
    y = max(y,p);
    }
}
printf("%lld %lld\n",x,y);

return 0;
}

#include<iostream>
#include<stdlib.h>
using namespace std;
long long n,k,a,b,x,y=-1;
long long ucln(long long i,long long j){
    if(j==0) return i;
    return ucln(j,i%j);
}
long long xuli(long long i,long long j){
    int uc=ucln(i,j);
    return i/uc;
}
int main(){
    cin>>n>>k;
    cin>>a>>b;
    a; x=n*k+1;
    for(int i=0;i<n;i++){
        long long e=abs(b+k*i-a);
        long long tam;
        if(e==0) tam=1;
        else tam=xuli(n*k,e);
        x=min(x,tam);
        y=max(y,tam);
        e=abs(k*(i+1)-b-a);
        if(e==0) tam=1;
        else tam=xuli(n*k,e);
        x=min(x,tam);
        y=max(y,tam);
    }
    cout<<x<<" "<<y;
}

#include <bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

#define si(a)           scanf("%d",&a)
#define sii(a,b)        scanf("%d %d",&a,&b)
#define siii(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define sl(a)           scanf("%lld",&a)
#define sll(a,b)        scanf("%lld %lld",&a,&b)
#define slll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define mp              make_pair
#define all(v)          v.begin(),v.end()
#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

#define PI              acos(-1.0)

//inline int setBit(int n,int pos) { return n = n | (1 << pos); }
//inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
//inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }
//inline int countBit(ll n) { return __builtin_popcountll(n); }

//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

/******************************************************************************************/

//const int MAX = 300010;
//const int INF = 0x3f3f3f3f;
//const double inf = 1.0/0.0;
//const int MOD = 1000000007;

ll n,k,a,b;

ll dist(ll x) {
    if(k == 1) return 0;
    x %= k;
    if(x == 0) return 1;
    else return min(x-1,k+1-x);
}

ll getL(ll s,ll e) {
    if(s<=e) return e - s;
    else return ( e + n * k - s);
}

int main() {
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    sll(n,k);
    sll(a,b);

    ll s = 1 + a;

    ll e, lim = sqrt(n*k);

    ll mn = n*k, mx = 0;

    ll N = n * k;

    for(ll i=1;i<=lim;i++) {
        if(N % i!=0) continue;
        e = s + i;
        if( e > N ) e -= N;
        if(dist(e) == b) {
            mn = min(mn,N/__gcd(N,getL(s,e)));
            mx = max(mx,N/__gcd(N,getL(s,e)));
        }

        e = s + N/i;
        if( e > N ) e -= N;
        if(dist(e) == b) {
            mn = min(mn,N/__gcd(N,getL(s,e)));
            mx = max(mx,N/__gcd(N,getL(s,e)));
        }
    }

    cout << mn << " " << mx << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
constexpr int inf = 0x3f3f3f3f;
constexpr double EPS = 1e-30;
constexpr double PI = atan(1) * 4;

template <typename T> inline bool chmax(T& x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> inline bool chmin(T& x, T y) {return x > y ? x = y, 1 : 0;}
inline int LSB(int i) {return (i & -i);}

ll n, k, a, b;

ll go(ll x, ll y){
    ll cur = y, res = 0;
    ll dif = y - x;
    if (y <= x) dif = (y + n * k - x);

//    printf("Run: %I64d %I64d\n", x, y);
//    for (ll i = n * k + x;; i += n * k){
//        if ((i - x) % dif == 0){
//            res += (i - x) / dif;
//            break;
//        }
//
//        printf("%I64d %I64d %I64d\n", i, x, dif);
//    }

    ll lcm = (n * k) / (__gcd(dif, n * k)) * dif;
//    printf("Returns %I64d\n", res);
    return lcm / dif;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> n >> k >> a >> b;

    //Possible start and first stop points (% k)
    ll s1 = 0, s2 = 0;
    s1 = a + 1, s2 = (k + 1) - a;

    ll e1 = 0, e2 = 0;
    e1 = b + 1, e2 = (k + 1) - b;

    if (n == 1){
        s2 = s1, e2 = e1;
    }

//    cout << s1 << " " << s2 << " " << e1 << " " << e2 << endl;
    //Min
    cout << min(min(go(s1, e1), go(s1, e2)), min(go(s2, e1), go(s2, e2))) << " ";

    //Max
    cout << max(max(go(s1, e1), go(s1, e2)), max(go(s2, e1), go(s2, e2))) << endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <chrono>
#include <random>

#define int long long

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n, k;
	std::cin >> n >> k;
	int a, b;
	std::cin >> a >> b;
	int s, t;
	s = b, t = (k - b) % k;
	s = std::max(a-s, s-a), t = std::max(t-a, a-t);
	s = gcd(s, k), t = gcd(t, k);
	s = s == 0 ? 1 : k / s;
	t = t == 0 ? 1 : k / t;
	int mn = k + 1, mx = -1;
	for(int i = 1; i <= n; i++) {
		if(n % i == 0) {
			mn = std::min(mn, lcm(s, i));
			mx = std::max(mx, lcm(t, i));
		}
	}
	std::cout << mn << ' ' << mx << '\n';
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <string>

using namespace std;
typedef long long LL;

LL mod(LL x, LL m){
    x %= m;
    while(x < 0) x += m;
    return x;
}

LL distance(LL a, LL b, LL mod){
    return min((abs(a-b)), abs(a + mod - b));
}

int gcd(int a, int b)
{
    for (;;)
    {
        if (a == 0) return b;
        b %= a;
        if (b == 0) return a;
        a %= b;
    }
}

int lcm(int a, int b)
{
    int temp = gcd(a, b);

    return temp ? (a / temp * b) : 0;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    // cities 0 .. n*k
    // Restaurant at 0, k, 2k...

    LL n, k;
    cin >> n >> k;
    LL a, b; // Distance to restaurant: from start, from first stop
    cin >> a >> b;

    vector<LL> firsts; // First stop possibilities
    for(LL i = 0; i < n; i++){
        firsts.push_back(mod(i*k + b, n*k));
        firsts.push_back(mod(i*k - b, n*k));
    }

    LL mini = 2 * 1e18;
    LL maxi = -1;
    for(LL x : firsts){
        LL l = distance(a, x, n*k);
        if(l == 0) l = n*k;
        //cout << "l = " << l << ", first = " << x << endl;
        mini = min(mini,lcm(n*k,l) / l);
        maxi = max(maxi,lcm(n*k,l) / l);
    }
    cout << mini << " " << maxi << endl;
}

/*
	ID: sixathofpain
	TASK: friday
	LANG: C++

*/

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(1e5) + 999;
#define int long long int

int32_t main(){
    IOS;

    int n,k;
    cin>>n>>k;
    int a,b;
    cin>>a>>b;

    int mn = 1e18;
    if(a==0 and b==0)
    	mn = 1;
    int mx = 1;
    int st;
    st = k+1-a;
    int m = k;
    for(int i = 0;i<=3*max(n,k);i++){
    	int l = i*k+1-b-st;
    	if(l<0)
    		continue;
    	l%=(n*m);
    	if(l==0){
    		mn = min(1LL,mn);
    		mx = max(1LL,mn);
    	}
    	if(l>0){
    		int x = (1LL*n*m*l)/__gcd(n*m,l);
    		if(x>0){
	    		mn = min(mn,x/l);
	    		mx = max(mx,x/l);
	    	}
    	}
    	l = i*k+1+b-st;
    	if(l<0)
    		continue;
    	l%=(n*m);
    	if(l>0){
    		int x = (1LL*n*m*l)/__gcd(n*m,l);
    		if(x>0)
    		mn = min(mn,x/l),    		mx = max(mx,x/l);
    	}
    }
    st = k+a+1;

	for(int i = 0;i<=3*max(n,k);i++){
    	int l = i*k+1-b-st;
    	if(l<0)
    		continue;
    	l%=(n*m);
    	if(l==0){
    		mn = min(1LL,mn);
    		mx = max(1LL,mx);
    	}
    	if(l>0){
    		// l%=(n*m);
    		int x = (1LL*n*m*l)/__gcd(n*m,l);
    		if(x>0)    		mn = min(mn,x/l),    		mx = max(mx,x/l);
    	}
    	l = i*k+1+b-st;
    	if(l<0)
    		continue;
    	l%=(n*m);
    	if(l>0){
    		// l%=(n*m);
    		int x = (1LL*n*m*l)/__gcd(n*m,l);
    		if(x>0)    		mn = min(mn,x/l),    		mx = max(mx,x/l);
    	}
    }
    mn = max(1LL,mn);
    mx = max(1LL,mx);
    cout<<mn<<" "<<mx<<endl;

    return 0;
}

// User: el_heffeh
// Date: 6/10/20

#include <bits/stdc++.h>

using namespace std;

long long n, k, a, b, p, x = 1e18, y = -1, s, val;

void solve() {
	cin >> n >> k >> a >> b;
	p = n * k;
	s = a + 1;
	vector<int> l;
	for (long long i = 1; i <= p; i += k) {
		val = i - b - s;
		if (val <= 0) {
			val += p;
		}
		if (val > p) {
			val -= p;
		}
		l.push_back(val);
		val = i + b - s;
		if (val <= 0) {
			val += p;
		}
		if (val > p) {
			val -= p;
		}
		l.push_back(val);
	}
	for (long long i: l) {
		if (i != 0 && i != p) {
			val = min(i, p - i);
		} else {
			val = p;
		}
		x = min(x, p / val);
		y = max(y, p / val);
	}
	cout << x << ' ' << y << endl;
}

int main() {
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
	solve();
    return 0;
}

/*
	When writing code, be sure to look out for:
 	* Array out of bounds access
 	* Integer overflow
 	* Variable scopes and names
 	* Be proactive and make sure to completely think a whole problem through before writing any code
 	Coding is a fun activity, and it should be treated that way. Don't get mad over some failed test cases or time limit exceeded verdicts. Keep your cool and stay calm!
*/

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
int main()
{
    ll n, k, a, b;
    scanf("%I64d%I64d%I64d%I64d", &n, &k, &a, &b);
    ll mins = 1ll << 60, maxs = -mins;
    for(int i = 1; i <= n; i++)
    {
        ll l1 = 1ll * i * k + b - a;
        ll l2 = 1ll * i * k - b - a;
        if(!l1 && !l2)  continue;
        else if(!l1) {mins = min(mins, lcm(n * k, l2) / l2), maxs = max(maxs, lcm(n * k, l2) / l2);}
        else if(!l2) {mins = min(mins, lcm(n * k, l1) / l1), maxs = max(maxs, lcm(n * k, l1) / l1);}
        else
            l1 = lcm(n * k, l1) / l1, l2 = lcm(n * k, l2) / l2, mins = min(mins, min(l1, l2)), maxs = max(maxs, max(l1, l2));
    }
    printf("%I64d %I64d\n", mins, maxs);
}

#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;

#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll mod = (1000000007LL);
inline ll Mod(ll a, ll b){return (a%b);}
inline ll poww(ll a, ll b){ll res = 1;while (b > 0){if(b & 1) res = (res * a)%mod;a = (a * a)%mod;b >>= 1;}return res;}
ll gcd (ll a, ll b) { while (b) { a %= b,swap(a, b);}return a;}
void read(vector<int> &w, int n){w.resize(n);for(int i = 0; i < n; i++) cin>>w[i];}
void print(vector<int> &w){for(int i =0; i < sz(w); i++){if(i == sz(w) - 1) cout<<w[i]<<"\n";else cout<<w[i]<<" ";}}
int prodmod(vector<int> w);
int summod(vector<int> w);
///CUIDADO COM MAXN
#define N 300050

int n, m, q, k, v[N], ans;
pii w[N];
string s;
int a, b;
bool check(int i){

}
int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin>>n>>k;
	cin>>a>>b;
	vector<int> A, B;
	int len = (n*k);
	for(int i = 0; i < n*k; i += k){
		int L = ((i-a)%len + len)%len;
		int R = ((i+a)%len + len)%len;
		A.pb(L);
		A.pb(R);
		B.pb(((i-b)%len + len)%len);
		B.pb(((i+b)%len + len)%len);
	}
	int menor = 2000000000;
	int maior=-menor;
	for(int delta = 0; delta <= n; delta ++){
		for(int sa=-1;sa <=1;sa++){
			for(int sb=-1;sb<=1;sb++){
				if(sa == 0 or sb == 0) continue;
				int l = (k*delta +sa*a + sb*b)%len;
				if(l < 0)l += len;
				if(l == 0) l =len;
				int mmc = (l*len)/gcd(l, len);
				menor=min(menor, mmc/l);
				maior=max(maior, mmc/l);
			}
		}
	}
	cout<<menor<<" "<<maior<<"\n";
}
/*
    CUIDADO COM MAXN, MOD, OVERFLOW
    >Colocar (>DEFINE INT LONG LONG<) no inicio do template
    >mod = (1e9 + 7), por padrao (NAO ESQUECER DE ALTERAR)
    >NAO ESQUECER DEFINE INT LONG LONG
    > N = 1 ?
*/
int summod(vector<int> w){int curr=0;for(int i=0;i<sz(w); i++){curr = (curr+w[i])%mod;if(curr<0)curr+=mod;}return curr;}
int prodmod(vector<int> w){int curr = 1;
for(int i = 0; i < sz(w); i++){if(w[i] >= mod) w[i] %= mod;curr = (curr * w[i]) % mod;if(curr < 0) curr += mod;}return curr;}

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
//#pragma comment(linker, "/STACK:16777216")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>

using namespace std;
using namespace __gnu_pbds;

#define LL long long
#define int long long
#define fi first
#define se second
#define pll pair<LL, LL>
#define pii pair<LL, LL>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define SZ(x) ((int)(x.size()))
#define LC (id<<1)
#define RC (id<<1|1)

constexpr int N = 2e6+9;
constexpr int M = 998244353 ;
#ifdef int
constexpr int INF = 0x3f3f3f3f3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcfcfcfcfcf;
#else
constexpr int INF = 0x3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcf;
#endif

int n, k, a, b;

signed main() {
    fastio;
    cin >> n >> k >> a >> b;
    int mini = n*k, maxi = 1;
    for (int x: {a, k-a}) {
        for (int y: {b, k-b}) {
            for (int i = 0; i <= n; i++) {
                if (y+i*k - x <= n*k && y+i*k - x > 0) {
                    int l = y+i*k - x;
                    maxi = max(maxi, lcm(l, n*k) / l);
                    mini = min(mini, lcm(l, n*k) / l);
                }
            }
        }
    }
    cout << mini << " " << maxi <<"\n";
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set=tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<int,ull> piu;
typedef vector<vector<int>> matrix;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=5e5+123;
const int M=1e6+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k,a,b;
    cin>>n>>k>>a>>b;
    vector<int>x,y;
    ll s=1ll*n*k;
    int z=min(n,2);
    for(int i=1;i<=(k+1)*z;i++){
        int v1=i%k-1;
        if(v1<0)v1+=k;
        int v2=(k-(i%k)+1)%k;
        if(min(v1,v2)==a)x.pb(i);
        if(min(v1,v2)==b)y.pb(i);
    }
    ll mn=s,mx=1;
    for(int l : x){
        for(int r : y){
            ll d=(r-l)%s;
            if(d<=0)d+=s;
            d=s/__gcd(s,d);
            mn=min(d,mn);
            mx=max(mx,d);
        }
    }
    cout<<mn<<" "<<mx;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll foo(ll tot, ll f){
    if(tot%f == 0) return tot/f;
    else return foo(tot, __gcd(tot, f));

}

vector<ll> shops;

ll nk;

ll getMinDist(ll a, ll b){

    if(a>b) swap(a, b);

    ll d1 = b - a;
    ll d2 = nk - b + a;

    return min(d1, d2);
}

ll minRet, maxRet;

void func(ll st, ll b){

    // first stop theke nearest shop er distance l

    // shamne (n-1) ta shop ache

    // prottektar age o pore

    for(auto it:shops){

        ll currentShop = it;

        ll p1 = (currentShop + b);

        if(p1 > nk) p1 -= nk;

        ll p2 = (currentShop - b);

        if(p2 <= 0) p2 += nk;

        ll d1 = getMinDist(p1, st);
        ll d2 = getMinDist(p2, st);

        if(d1 != 0) {
            ll t1 = foo(nk, d1);
            minRet = min(minRet, t1);
            maxRet = max(maxRet, t1);
        }
        else{
            minRet = min(minRet, 1LL);
        }
           if(d2 != 0) {
            ll t1 = foo(nk, d2);
            minRet = min(minRet, t1);
            maxRet = max(maxRet, t1);
        }
        else{
            minRet = min(minRet, 1LL);
        }

    }

}

int main()
{

    ll n, k, tot, a, b;

    cin>>n>>k>>a>>b;

    minRet = INT_MAX, maxRet = INT_MIN;

    nk = n*k;

    ll st = 1 + a;

    for(int i = 0; i<n; i++) shops.push_back(k*i + 1);

    int st1 = 1  + a;
    int st2 = k + 1 - a;

    if(st1>nk) st1 -= nk;
    if(st2<=0) st2 += nk;

    func(st1, b);
    func(st2, b);

  //  if(a == b) minRet = min(minRet, 1LL);

    cout<<minRet<<" "<<maxRet<<endl;

	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
using namespace std;

void check_forword(int s, long long l, int n, int m, long long &mi, long long &mx) {
	long long now = 1;
	long long pos = s + l;
	if (pos > 1LL * n * m) pos -= 1LL * n * m;
	while (pos != s) {
		if (pos < s) {
			long long t = (s - pos) / l;
			now += t;
			pos += t * l;
			if (pos > 1LL * n * m) pos -= 1LL * n * m;
			if (pos != s) {
				pos += l;
				if (pos > 1LL * n * m) pos -= 1LL * n * m;
				now++;
			}
		} else {
			long long t = (1LL * n * m + s - pos) / l;
			now += t;
			pos += t * l;
			if (pos > 1LL * n * m) pos -= 1LL * n * m;
			if (pos != s) {
				pos += l;
				if (pos > 1LL * n * m) pos -= 1LL * n * m;
				now++;
			}
		}
	}
	mi = min(mi, now);
	mx = max(mx, now);
}

void check_backword(int s, long long l, int n, int m, long long &mi, long long &mx) {
	long long now = 1;
	long long pos = s - l;
	if (pos < 0) pos += 1LL * n * m;
	while (pos != s) {
		if (pos > s) {
			long long t = (pos - s) / l;
			pos -= t * l;
			if (pos < 0) pos += 1LL * n * m;
			now += t;
			if (pos != s) {
				pos -= l;
				if (pos < 0) pos += 1LL * n * m;
				now++;
			}
		} else {
			long long t = (1LL * n * m - s + pos) / l;
			pos -= t * l;
			if (pos < 0) pos += 1LL * n * m;
			now += t;
			if (pos != s) {
				pos -= l;
				if (pos < 0) pos += 1LL * n * m;
				now++;
			}
		}
	}
	mi = min(mi, now);
	mx = max(mx, now);
}
int main()
{
	int n, m;
	cin >> n >> m;
	int a, b;
	cin >> a >> b;
	if (a == 0 && b == 0) {
		cout << 1 << " " << n << endl;
		return 0;
	}

	long long mi = 1LL << 60, mx = -(1LL << 60);
	for (int s = 1; s <= m; s++) {
		int x = s - 1;
		int y = m + 1 - s;
		if (min(x, y) != a) continue;

		for (int l = 1; l <= m; l++) {
			int p = (s + l - 1) % m + 1;
			int xx = p - 1;
			int yy = m + 1 - p;
			if (min(xx, yy) != b) continue;
			check_forword(s, l, n, m, mi, mx);
			check_forword(s, l + 1LL * (n - 1) * m, n, m, mi, mx);
			check_backword(s, l, n, m, mi, mx);
			check_backword(s, l + 1LL * (n - 1) * m, n, m, mi, mx);
		}
	}

	cout << mi << " " << mx << endl;
	return 0;
}

#include <iostream>
#include <numeric>
using namespace std;

long long int mdc(long long int a, long long int b)
{
  // if(b == 0)
  //   return a;
  if(a % b == 0)
    return b;
  return mdc(b, a % b);
}

int main()
{
  long long int rests, distRes, a, b, cidades, maxSalt = 0;
  cin >> rests >> distRes >> a >> b;
  cidades = distRes * rests;

  long long int minSalt = cidades;
  long long int soma = (a + b) % distRes;
  if(a == b)
    minSalt = 1;
  if(soma == 0)
  {
    maxSalt = rests;
    minSalt = 1;
  }
  else{
    for(int i = 0; i < rests; i++)
    {
      // int mmc1 = lcm(cidades, i * distRes + soma);
      // int mmc2 = lcm(cidades, (i + 1) * distRes - soma);
      long long int mmc1 = (cidades * (i * distRes + soma) / mdc(cidades, i * distRes + soma)) / (i * distRes + soma);
      // cout << i << ", 1: " << mmc1 << endl;
      long long int mmc2 = (cidades * (((i + 1) * distRes - soma) % cidades)) / mdc(cidades, (((i + 1) * distRes - soma) % cidades)) / (((i + 1) * distRes - soma) % cidades);
      // cout << i << ", 2: " << mmc2 << endl;
      if(mmc1 > maxSalt)
        maxSalt = mmc1;
      if(mmc1 < minSalt)
        minSalt = mmc1;
      if(mmc2 < minSalt)
        minSalt = mmc2;
      if(mmc2 > maxSalt)
        maxSalt = mmc2;
    }
  }
  cout << minSalt << " " << maxSalt << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a ,b) for(int i=a;i<b;i++)
#define repr(i ,a ,b) for(int i=a ;i>=b;i--)
#define pb push_back
#define mp make_pair
#define f first
#define s second
typedef long long ll;
typedef long double ld;
#define pii pair<int ,int>
#define pll pair<ll , ll>

#define PI  3.14159265358979323

int gcd(int a ,int b)
{
  if(b==0)
  return a;
  return gcd(b ,a%b);
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n ,k;
  cin>>n>>k;
  int a ,b;
  cin>>a>>b;
  int c[4];

  c[0]=b-a;
  c[1]=k-b-a;
  c[2]=b-(k-a);
  c[3]=(k-b)-(k-a);
  int ans1=1000000;
  int ans2=0;
  rep(i ,0 ,n)
  {
    rep(j ,0 ,4)
  {  int l=k*i + c[j];
    int z=n*k/(gcd(n*k ,l));
    ans1=min(ans1 , abs(z));
    ans2=max(ans2 ,abs(z));
  }
  }
  cout<<ans1<<" "<<ans2<<endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define MAX 1e18
#define N 1005
ll mod2 = 998244353;
ll mod = 1e9 + 7;

ll n,k;

ll a[N][N];

void solve()
{
  cin>>n>>k;
  ll a,b;
  cin>>a>>b;

  ll x = 1e9;
  ll y = 0;

  for(int i = 0;i<=n;++i)
  {
    ll q= i*k + b + a;
    ll w = abs(i*k - b - a);
    ll e = abs(i*k - b + a);
    ll r = abs(i*k +b - a);

    if(q&&(n*k)%q==0)
    {
      x = min(x,(n*k)/q);
      y = max(y,(n*k)/q);

    }

     if(w&&(n*k)%w==0)
    {
      x = min(x,(n*k)/w);
      y = max(y,(n*k)/w);

    }
     if(e&&(n*k)%e==0)
    {
      x = min(x,(n*k)/e);
      y = max(y,(n*k)/e);

    }
     if(r&&(n*k)%r==0)
    {
      x = min(x,(n*k)/r);
      y = max(y,(n*k)/r);

    }

  }

  cout<<x<<" "<<y;

}

int main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);

ll t=1;
//cin>>t;

while(t--)
{
  solve();
}
return 0;

}

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int a, int b)
{
	return (b == 0) ? a : gcd(b, a % b);
}

int main()
{
	int n, k;
	cin >> n >> k;
	int a, b;
	cin >> a >> b;

	int min = 1000000;
	int max = 0;

	int test[] = {(a + b) % k, (a - b) % k, (b - a) % k, ((-1*a)-b) % k};
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			int l = k * i + test[j];

			int res = (n * k) / gcd(n * k, l);

			if (res > max)
				max = res;
			if (res < min && res > 0)
				min = res;
		}
	}

	cout << min << " " << max << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define mod 1000000007
template<class T>
void printQueue(T& q)
{while (!q.empty()){cout << q.top() << endl;q.pop();}}

ll power(ll a,ll b)
{
    ll r=1;
    while(b!=0)
    {
        if(b%2!=0){r=r*a;}
        a=a*a; b=b/2;
    }
    return r;
}

int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;

        ll a,b;
        cin>>a>>b;

        vector<ll> astha;
        unordered_map<ll,int> piz;
        for(ll i=1;i<=(n*k);i=i+k)
        {
            if((i+b)<=(n*k)){ if(piz.find(i+b)==piz.end()){astha.pb(i+b); piz[i+b]=1;} }
            else{ if(piz.find(i+b-(n*k))==piz.end()){astha.pb(i+b-(n*k)); piz[i+b-(n*k)]=1;} }

            if(i>b){ if(piz.find(i-b)==piz.end()){astha.pb(i-b); piz[i-b]=1;} }
            else{ if(piz.find(n*k+i-b)==piz.end()){astha.pb((n*k)+i-b); piz[(n*k)+i-b]=1;} }
        }

        ll first,second,steps,lcm,vals,moves;
        vals=n*k;
        ll maxm_moves=0,minm_moves=1e18;
        if(a==0)
        {
            first=1;

            for(int i=0;i<astha.size();i++)
            {
                steps=abs(first-astha[i]);
                if(steps==0){moves=1;}
                else
                {
                    lcm=(vals*steps)/(__gcd(vals,steps));
                    moves=lcm/steps;
                }

                maxm_moves=max(maxm_moves,moves);
                minm_moves=min(minm_moves,moves);
            }
        }
        else
        {
            first=1+a; second=1+n*k-a;
            //cout<<"DAS"<<endl;
            for(int i=0;i<astha.size();i++)
            {
                steps=abs(first-astha[i]);
                if(steps==0){moves=1;}
                else
                {
                    lcm=__gcd(vals,steps);
                    moves=vals/lcm;
                }

                maxm_moves=max(maxm_moves,moves);
                minm_moves=min(minm_moves,moves);
                //cout<<steps<<" "<<moves<<endl;
            }

            for(int i=0;i<astha.size();i++)
            {
                steps=abs(second-astha[i]);
                if(steps==0){moves=1;}
                else
                {
                    lcm=(vals*steps)/(__gcd(vals,steps));
                    moves=lcm/steps;
                }

                maxm_moves=max(maxm_moves,moves);
                minm_moves=min(minm_moves,moves);
            }
        }

        cout<<minm_moves<<" "<<maxm_moves<<endl;
    }
}

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
using namespace std;

#define pii pair<int,int>

#define getcx getchar
inline void in(int &n)
{
    n=0; int ch = getcx(); int sign = 1;
    while(ch < '0' || ch > '9') { if(ch == '-') sign=-1; ch = getcx(); }
    while(ch >= '0' && ch <= '9') { n = (n << 3) + (n << 1) + ch - '0', ch = getcx(); }
    n = n * sign;
}

long long int gcd(long long int a, long long int b)
{
    while(b)
    {
        long long int tmp = a%b;
        a = b;
        b = tmp;
    }
    return a;
}

long long int lcm(long long int a, long long int b)
{
    long long int product = a;
    a = a/gcd(a,b);
    return a*b;
    //return product/gcd(a,b);
}
int main()
{
    int n,k;
    in(n);
    in(k);

    int a,b;
    in(a);
    in(b);

    vector<int> v;
    v.push_back((k+a-b)%k);
    v.push_back((k+a+b)%k);
    v.push_back((k-a-b)%k);
    v.push_back((k-a+b)%k);

    long long int _min = 1e18;
    long long int _max = 1;
    for(int i=0; i<v.size(); i++)
    {
        //printf("v[i] is %d\n",v[i]);
        long long int l = v[i];
        if(!l)
            l += k;

        long long int circle = n;
        circle *= k;
        while(l<=circle)
        {
            long long int y;
            if(circle%l==0)
            {
                y = circle/l;
            }
            else
            {
                y = lcm(l, circle)/l;
            }
            _min = min(_min, y);
            _max = max(_max, y);

            l += k;
        }
    }
    printf("%I64d %I64d\n",_min,_max);
}

#include <bits/stdc++.h>

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back;
#define fst first
#define snd second

typedef long long ll;

int main() {
    ll n, k; cin >> n >> k;
    ll a, b; cin >> a >> b;

    ll f1 = - a - 1;
    ll f2 = a - 1;
    ll f3 = - b - 1;
    ll f5 = b - 1;
    map<ll, ll> f;
    fore(s, 1, k + 1) {
        if(((s + f1) % (n*k)) % k == 0 || ((s + f2) % (n*k)) % k == 0) {
            ll l1 = k - s - b + 1;
            ll l2 = k - s + b + 1;
            l1 = abs(s - (s + l1) % (n*k));
            l2 = abs(s - (s + l2) % (n*k));
            f[l1]++;
            f[l2]++;
        }
    }

    ll m = 1e18;
    ll mm = 0;
    for(auto x : f) if(x.fst) {
        if((n*k) % x.fst == 0) {
            if(k % x.fst == 0 && x.fst + k <= n * k) m = 1;
            m = min(n*k / x.fst, m);
            mm = max(n*k / x.fst, mm);
        } else {
            m = min(n * k, m);
            mm = max(n * k, mm);
        }
    }
    cout << m << " " << mm << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL lcm(LL a,LL b){
	return a/__gcd(a,b)*b;
}
LL da[4]={1,-1,-1,1};
LL db[4]={-1,1,-1,1};
int main(){
	LL n,k,a,b,mx=0,mn=LLONG_MAX;
	cin>>n>>k>>a>>b;
	for(LL i=0;i<n;i++){
		for(int j=0;j<4;j++){
			LL s=i*k+da[j]*a+db[j]*b;
			if(s<=0) s+=n*k;
			LL l=lcm(n*k,lcm(k,s))/s;
			mn=min(mn,l);
			mx=max(mx,l);
		}
	}
	cout<<mn<<" "<<mx<<"\n";
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ull;
typedef unsigned long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7;
const ll INF = 1e17;
const double EPS = 1e-7;

#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define FOR(i, n) for (ll i = 0; i<n; i++)
#define pb push_back
#define pf push_front
#define IN(v) for (auto &e : v) cin >> e;
#define OUT(v) for (auto &e : v) cout << e << ' ';
#define PI 3.14159265

#define sort2(v, structName, structMember1, structMember2) \
     sort(all(v), [&](const structName& l, const structName& r) \
          { return tie(l.structMember1, l.structMember2) < tie(r.structMember1, r.structMember2); });

#define sort3(v, structName, structMember1, structMember2, structMember3) \
     sort(all(v), [&](const structName& l, const structName& r) \
          { return tie(l.structMember1, l.structMember2, l.structMember3) < tie(r.structMember1, r.structMember2, r.structMember3); });

inline void tostr(string &s, auto num) {stringstream ss; ss<<num; ss>>s;}
inline void toint(auto &num, string s) {stringstream ss; ss<<s; ss>>num;}
inline long double fact(auto n) {return (n == 1 || n == 0) ? 1 : fact(n - 1) * n;}
inline long long mod(auto a, auto b) {return (a+(abs(a)/b+1)*b)%b;}
inline long long __lcm(auto a, auto b) {return ((ld)a*(ld)b/(ld)__gcd(a, b));}

/*_____________________________________________________*/

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n, k, a, b;
    cin >> n >> k >> a >> b;

    ll mn = INF, mx = 1;

    for (ll i = 0; i <= n-1; i++)
    {
        ll l = i*k + b - a;
        if (l <= 0)
            l = n*k + l;
        mn = min(mn, __lcm(k*n, l)/(l));
        mx = max(mx, __lcm(k*n, l)/(l));

        l = (i+1)*k - b - a;
        if (l != 0)
        {
            mn = min(mn, __lcm(k*n, l)/(l));
            mx = max(mx, __lcm(k*n, l)/(l));
        }
    }

    cout << mn << " " << mx;
}

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 100005
#define INF 1000000000000000000LL
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
ll n,k,a,b;
int main()
{
    scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
    ll minx=INF,maxx=-INF;
    for(ll i=0;i<2;i++)
        for(ll j=0;j<2;j++)
        {
            ll dis1=(i?a:k-a),dis2=(j?b:k-b);
            ll d=dis2-dis1;
            while(d<=0) d+=k; while(d>k) d-=k;
            ll moves=k/__gcd(d,k);
            ll num=d*moves/k;
            for(ll cyc=0;cyc<n;cyc++)
            {
                ll res=(cyc*num+1)%n;
                ll ans=n/__gcd(n,res)*moves;
                minx=min(minx,ans); maxx=max(maxx,ans);
            }
        }
    printf("%lld %lld\n",minx,maxx);
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int n,k,a,b,u,l,d,x,y,b1,b2;

int main()
{
    scanf("%d%d%d%d",&n,&k,&a,&b);
    b1 =  b+1; b1%=k; if (b1 == 0) b1+=k;
    b2 =k-b+1; b2%=k; if (b2 == 0) b2+=k;
    u = n*k; ++a;
    x = n*k; y = 1;

    for(int i=b1; i<=u; i+=k) for(int j=1; j<=2; ++j) {
            l = abs(a-i);
            if (j==2) l = u-l;
            if (l==0) l = u;
            d = u / __gcd(u,l);
            x = min(x,d);
            y = max(y,d);
        }
    for(int i=b2; i<=u; i+=k) for(int j=1; j<=2; ++j) {
            l = abs(a-i);
            if (j==2) l = u-l;
            if (l==0) l = u;
            d = u / __gcd(u,l);
            x = min(x,d);
            y = max(y,d);
        }

    printf("%d %d",x,y);
}

#include <bits/stdc++.h>
using namespace std;

int64_t lcm(int64_t a, int64_t b) {
    return a * (b / __gcd(a, b));
}

int64_t n, k;

int64_t calc(int64_t a, int64_t b) {
    int64_t l = abs(a - b);
    l = (l + k) % k;

    return l == 0 ? 1 : lcm(l, n * k) / l;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int64_t a, b;

    cin >> n >> k;
    cin >> a >> b;

    int64_t res[] = {calc(a, b), calc(a, k - b), calc(k - a, b), calc(k - a, k - b)};

    int64_t x = *min_element(res, res+4),
            y = *max_element(res, res+4);

    if (x == 1 && y == 1)
        y = n;

    cout << x << " " << y << "\n";

    return 0;
}

#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string.h>
#include <limits.h>
#include <string>
#include <iostream>
#include <queue>
#include <math.h>
#include <map>
#include <stack>
#include <set>
#define left (now<<1)
#define right ((now<<1)+1)
#define mid ((l + r) >> 1)
#define midmid ((r + mid) >> 1)
#define LONG_LONG_MIN -9223372036854775808ll
#define LONG_LONG_MAX 9223372036854775807ll
using namespace std;
typedef long long int ll;

const int MAXN = 1e5 + 10;

ll n,k,a,b,x,y;

ll gcd(ll a,ll b){
    return a % b == 0 ? b : gcd(b,a % b);
}

int main(){
    scanf("%I64d%I64d",&n,&k); scanf("%I64d%I64d",&a,&b);
    ll p = a - b; y = -1; x = LONG_LONG_MAX;
    if(p < 0){
        p += k;
    }else if(p == 0){
        x = 1; p += k;
    }

    ll now = n * k / gcd(n * k,p);
    y = max(y,now);
    x = min(x,now);
    p = k - a - b;
    if(p < 0){
        p += k;
    }else if(p == 0){
        x = 1; p += k;
    }
    now = n * k / gcd(n * k,p);
    y = max(y,now);
    x = min(x,now);
    printf("%I64d %I64d\n",x,y);
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
long long n,k,a,b,ma,mi=1e18;
void solve(long long s,long long t)
{
	if (s==t) {mi=1; return;}
	//printf("lalal %lld %lld\n",s,t);
	if (s<t)
	{
		mi=min(mi,n*k/__gcd(n*k,t-s));
		ma=max(ma,n*k/__gcd(n*k,t-s));
		mi=min(mi,n*k/__gcd(n*k,n*k+t-s));
		ma=max(ma,n*k/__gcd(n*k,n*k+t-s));
	}
	else
	{
		mi=min(mi,n*k/__gcd(n*k,n*k+t-s));
		ma=max(ma,n*k/__gcd(n*k,n*k+t-s));
	}
return;
}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&k,&a,&b);
	for (long long i=1;i<=n;i++)
	{
		long long r=1+(i-1)*k+b;
		if (r>n*k) r-=n*k;else if (r<1) r+=n*k;
		solve(1+a,r);
		r=1+(i-1)*k-b;
		if (r>n*k) r-=n*k;else if (r<1) r+=n*k;
		solve(1+a,r);
	}
	printf("%lld %lld\n",mi,ma);
return 0;
}

#include<iostream>
#include <vector>
#include<map>
using namespace std;
long long n, k, a, b, minstop = 2147483647, maxstop;
long long gcd(long long a, long long b){
	if(a < b)swap(a, b);
	while(a % b != 0){
		a %= b;
		swap(a, b);
	}
	return b;
}
long long getstop(long long l){
	if(l < 0)l += n * k;
	// cout << "getstop " << l << ' ';
	if(l == n * k || l == 0)return 1;
	return n * k / gcd(l, n * k);
}
long long locof(long long i){
	return i * k + 1;
}
void update(long long cost){
	minstop = min(minstop, cost);
	maxstop = max(maxstop, cost);
}
int main(){
	cin >> n >> k >> a >> b;
	long long s = 1 + a;
	for(long long i = 1;i <= k;++i){
            // cout << "loc " << s << ' ' << locof(i) - b << '\n';
		long long cost = getstop(locof(i) - b - s);
		// cout << cost <<'\n';
		update(cost);
	}
	for(long long i = 0;i < k;++i){
		// cout << "loc " << s << ' ' << locof(i) + b << '\n';
		long long cost = getstop(locof(i) + b - s);
    // cout << cost << '\n';
		update(cost);
	}
	s = locof(1) - a;
	for(long long i = 1;i <= k;++i){
		// cout << "loc " << s << ' ' << locof(i) - b << '\n';
		long long cost = getstop(locof(i) - b - s);
		// cout << cost << '\n';
		update(cost);
	}
	for(long long i = 0;i < k;++i){
		// cout << "loc " << s << ' ' << locof(i) + b << '\n';
		long long cost = getstop(locof(i) + b - s);
		// cout << cost <<'\n';
		update(cost);
	}
	// for(long long j = 1;j <= k;++j){
 //            cout << j * k - b - a << '\n';
	// 	if(j * k - b - a == 0 || j * k - b - a == n * k)continue;
	// 	long long stop = getstop(j * k - b - a);
	// 	cout << "JJ "<<j * k - b - a << '\n';
	// 	minstop = min(stop, minstop);
	// 	maxstop = max(stop, maxstop);
	// }
	// for(long long j = 0;j < k;++j){
	// 	if(j * k + b - a == 0)continue;
	// 	long long stop = getstop(j * k + b - a);
	// 	minstop = min(minstop, stop);
	// 	maxstop = max(maxstop, stop);
	// }
	// for(long long j = 1;j <= k;++j){
	// 	if(j * k + 1 - b - (k + 1 - a) == 0 || j * k + 1 - b - (k + 1 - a) == n * k)continue;
	// 	long long stop = getstop(j * k + 1 - b -(k + 1 - a));
	// 	minstop = min(stop, minstop);
	// 	maxstop = max(stop, maxstop);
	// }
	// for(long long j = 0;j < k;++j){
	// 	if(j * k + 1 + b - (k + 1 - a) == 0)continue;
	// 	long long stop = getstop(j * k + 1 + b - (k + 1 - a));
	// 	minstop = min(minstop, stop);
	// 	maxstop = max(maxstop, stop);
	// }
	cout << minstop << ' ' << maxstop;
}

//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln endl
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inp freopen("input.txt", "r", stdin)
#define outp freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const ll MOD = 1e9+7, LIM = 1e5+5;
const ld EPS = 1e-9;

int main(){
	fastio;

	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

	ll n,k;
	cin>>n>>k;
	ll a,b;
	cin>>a>>b;
	set<ll> st,e;
	ll p = n*k;
	forn(i,n){
		st.insert((k*i-a+p)%p);
		st.insert((k*i+a)%p);
		e.insert((k*i-b+p)%p);
		e.insert((k*i+b)%p);
	}
	v64 start,en;
	forstl(r,st){
	//if(r<1000000) cout<<r<<" ";
		start.pb(r);
	}
	//cout<<ln;
	forstl(r,e){
	//if(r<1000000)cout<<r<<" ";
		en.pb(r);
	}
	//cout<<ln;
	ll maans=0, mians=1e18;
	//cout<<p<<ln;
	forn(i,5*1e5){
		int k = rng()%(start.size());
		int j = rng()%(en.size());
		ll l;
		if(en[j]==start[k]) l=p;
		if(en[j]>start[k]) l = en[j]-start[k];
		else l = p-start[k]+en[j];
		//if(__gcd(p,l)>1) cout<<k<<" "<<l<<ln;
		mians = min(mians,p/__gcd(p,l));
		maans = max(maans,p/__gcd(p,l));
	}
	cout<<mians<<" "<<maans<<ln;
	//cout<<ln;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005,INF=1<<30;

ll gcd(ll a,ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}

int main(){

    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N,K,A,B;cin>>N>>K>>A>>B;

    ll mini=INF,maxi=0;
    ll start=A;

    for(ll i=0;i<N;i++){
        ll goal=i*K+B;
        if(start<=goal){
            ll dis=goal-start;
            ll ans=N*K/gcd(N*K,dis);
            mini=min(mini,ans);
            maxi=max(maxi,ans);
        }else{
            ll dis=N*K-(goal-start);
            ll ans=N*K/gcd(N*K,dis);
            mini=min(mini,ans);
            maxi=max(maxi,ans);
        }

        goal=(i+1)*K-B;
        if(start<=goal){
            ll dis=goal-start;
            ll ans=N*K/gcd(N*K,dis);
            mini=min(mini,ans);
            maxi=max(maxi,ans);
        }else{
            ll dis=N*K-(goal-start);
            ll ans=N*K/gcd(N*K,dis);
            mini=min(mini,ans);
            maxi=max(maxi,ans);
        }
    }

    cout<<mini<<" "<<maxi<<endl;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;

long long int mi=1e18,ma=0;

long long int n,k,a,b;

vector<long long int> deln;
vector<long long int> delk;
vector<long long int> del;

void go(long long int t)
{
    for (auto x:del)
    {
        long long int pos=(t+x)%(n*k);
        if ((pos+b)%k==0||(pos-b)%k==0)
        {
            //cout << t << ' ' << x << ' ' << pos << endl;
            mi=min(n*k/x,mi);
            ma=max(n*k/x,ma);
        }
    }
}

int main()
{
    cin >> n >> k >> a >> b;

    for (long long int i=1;i*i<=n*k;i++)
    {
        if ((n*k)%i==0)
        {
            del.push_back(i);
            del.push_back((n*k)/i);
        }
    }

    go(a);
    if(a)
        go(n*k-a);

    cout << mi << ' ' << ma << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define int ll
#define debug cout<<"fuck"<<endl;
#define pb  push_back
const int mod=(int)1e9+7;
const int maxn=(int)1e5+5;
ll quick_pow_mod(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b & 1)
        {
            res=(res*a)%c;
        }
        a=(a*a)%c;
        b=b>>1;
    }
    return res;
}
int n,k;
int a,b;

int dis(int l)
{
    return (n*k*l)/__gcd(n*k,l)/l;
}

signed main()
{
    IOS
    cin>>n>>k;
    cin>>a>>b;
    int maxn=-1;
    int minn=(int)1e17;
    int maxx=n*k;
    int ans;
    for(int i=0;i<=n;i++)
    {
        if (i*k-a-b>=1)
        {
            ans = dis(i*k-a-b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=0;i<=n;i++)
    {
        if (i*k+a+b>=1)
        {
            ans = dis(i*k+a+b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=0;i<=n;i++)
    {
        if (i*k-a+b>=1)
        {
            ans = dis(i*k-a+b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=0;i<=n;i++)
    {
        if (i*k+a-b>=1)
        {
            ans = dis(i*k+a-b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    cout<<minn<<' '<<maxn<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL lcm(LL a,LL b){
	return a/__gcd(a,b)*b;
}
LL da[4]={1,-1,-1,1};
LL db[4]={-1,1,-1,1};
int main(){
	LL n,k,a,b,mx=0,mn=LLONG_MAX;
	cin>>n>>k>>a>>b;
	for(LL i=0;i<n;i++){
		for(int j=0;j<4;j++){
			LL s=i*k+da[j]*a+db[j]*b;
			if(s<=0) s+=n*k;
			LL l=n/__gcd(n*k,s)*k;
			mn=min(mn,l);
			mx=max(mx,l);
		}
	}
	cout<<mn<<" "<<mx<<"\n";
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    LL n, k, a, b; cin >> n >> k >> a >> b;
    vector<LL> list;
    for (int i = 0 ; i < n ; i++) {
        list.push_back(((i * k + b + n * k) % (n * k) + n * k - a) % (n * k));
        list.push_back(((i * k - b + n * k) % (n * k) + n * k - a) % (n * k));
    }
    sort(list.begin(), list.end());
    list.erase(unique(list.begin(), list.end()), list.end());
    LL maxV = -INF, minV = INF;
    for (auto &v : list) {
        if (!v) v += n * k;
        LL lcm = v * (n * k) / __gcd(v, n * k);
        maxV = max(maxV, lcm / v);
        minV = min(minV, lcm / v);
    }
    cout << minV << ' ' << maxV << '\n';
}

/*Template by hemnath_d(Enlightened by chamow)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll,ll>
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fx first
#define sx second
#define inf 100000000000000
#define minf -100000000000000
ll lcm(ll a,ll b)
{
	return (b)/__gcd(a,b);
}
int main()
{
    fastread;
    vec start,end;
    int n,k,a,b;
    cin>>n>>k>>a>>b;
    start.pb(1+a);start.pb(k+1-a);
    ll tot=(n*k);
    ll mini=LLONG_MAX,maxi=LLONG_MIN;
    for(int i=0;i<start.size();i++)
    {
    	for(int j=0;j<n;j++)
    	{
    		ll tempa=(j*k+1)+b;
    		ll tempb=((j+1)*k+1)-b;
    		ll dista=(tempa-start[i]+tot)%tot;
    		if(dista==0)dista+=tot;
    		ll distb=(tempb-start[i]+tot)%tot;
    		if(distb==0)distb+=tot;
    		ll mdista=lcm(dista,tot);
    		ll mdistb=lcm(distb,tot);
    		mini=min(mini,mdista);
    		mini=min(mini,mdistb);
    		maxi=max(maxi,mdista);
    		maxi=max(maxi,mdistb);
    	}
    }
    cout<<mini<<" "<<maxi<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair<int,int>
#define iii pair<ii, int>
#define iiii pair<ii, ii>
#define viiii vector< iiii >
#define viii vector< iii >
#define vii vector< ii >
#define vi vector< int >
#define int long long

#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define FOR(v, i, l) for(int v = i; v < (int)l; ++v)
#define REP(v, l) FOR(v, 0, l)

#define MAXN 100005
#define MAXM 305
#define MAXB 20
#define EPS 1e-6
#define oo (1LL<<30)
#define OO (1LL<<60)

const int dx[8] = {1, 0, 0, -1, 1, 1, -1, -1};
const int dy[8] = {0, 1, -1, 0, 1, -1, 1, -1};

int n, k;
int a, b;
vector<int> L;

int lcm(int a, int b){
   return (a*b)/__gcd(a,b);
}

main(){
   scanf("%lld %lld", &n, &k);
   scanf("%lld %lld", &a, &b);
   int d1 = a;
   int d2 = k - a;

   int maior = 1;
   int menor = k*n;

   int o[4];
   o[0] = k - a - b;
   o[1] = k - a + b;
   o[2] = a + b;
   o[3] = k + a - b;
   for(int j = 0; j < 4; j++)
      if(!o[j])
         o[j]+=k;

   for(int i = 0; i <= k; i++){
      for(int j = 0; j < 4; j++){
         int d = o[j]+i*k;
         int stop = lcm(n*k, d)/(d);
         maior = max(maior, stop);
         menor = min(menor, stop);
         //printf("%lld %lld >>> %lld %lld\n", i, j, d, stop);
      }
   }

   printf("%lld %lld\n", menor, maior);
}

#include<iostream>
#include<vector>
#define ll long long
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)

using namespace std;

ll n,k;
ll a,b;
vector<ll> l;
ll x=1e9,y=-1;

ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	cin>>n>>k>>a>>b;
	l.push_back(b-a);
	l.push_back(k-a-b);
	l.push_back(a-b);
	l.push_back(a+b);
	ll dis=n*k;
	for(int i=0;i<l.size();i++){
		for(int j=0;j<=n;j++){
			if((j*k+l[i])<=0) continue;
			ll g=gcd(dis,(j*k+l[i]));
			x=min(x,dis/g);
			y=max(y,dis/g);
		}
	}
	cout<<x<<' '<<y<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int64_t lcm(int64_t a, int64_t b) {
    return a * (b / __gcd(a, b));
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int64_t n, k, a, b;

    cin >> n >> k;
    cin >> a >> b;

    set<int> s, f;

    for (int i = 0; i < 2*k; i++) {
        if (i % k == a || i % k == k - a) {
            s.insert(i);
        }
    }

    for (int i = 0; i < 2*k; i++) {
        if (i % k == b || i % k == k - b) {
            f.insert(i);
        }
    }

    int l;
    int64_t x = n * k, y = 0, z;

    for (const auto &i : s) {
        auto it = f.lower_bound(i);

        if (it != f.end() && *it == i) {
            x = 1; // can make one stop
            y = max(y, n);

            // get a greater guy
            it++;
        }

        if (it == f.end()) {
            continue;
        }

        l = *it - i;
        z = lcm(l, n * k) / l;
        y = max(y, z);
    }

    l = *prev(f.end()) - *s.begin();
    if (l > 0)
        x = min(x, lcm(l, n * k) / l);

    cout << x << " " << y << "\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define int ll
#define debug cout<<"fuck"<<endl;
#define pb  push_back
const int mod=(int)1e9+7;
const int maxn=(int)1e5+5;
ll quick_pow_mod(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b & 1)
        {
            res=(res*a)%c;
        }
        a=(a*a)%c;
        b=b>>1;
    }
    return res;
}
int n,k;
int a,b;

int dis(int l)
{
    return (n*k*l)/__gcd(n*k,l)/l;
}

signed main()
{
    IOS
    cin>>n>>k;
    cin>>a>>b;
    int maxn=-1;
    int minn=(int)1e11;
    int maxx=n*k;
    int ans;
    for(int i=1;i*k-a-b<=maxx;i++)
    {
        if (i*k-a-b>=1&&i*k-a-b<=maxx)
        {
            ans = dis(i*k-a-b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=1;i*k+a+b<=maxx;i++)
    {
        if (i*k+a+b>=1&&i*k+a+b<=maxx)
        {
            ans = dis(i*k+a+b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=1;i*k-a+b<=maxx;i++)
    {
        if (i*k-a+b>=1&&i*k-a+b<=maxx&&a+1)
        {
            ans = dis(i*k-a+b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=1;i*k+a-b<=maxx;i++)
    {
        if (i*k+a-b>=1&&i*k+a-b<=maxx)
        {
            ans = dis(i*k+a-b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    cout<<minn<<' '<<maxn<<endl;

    return 0;
}

/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = []() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

/* It is about divisors and gcd.
 * There are k distinct startpoints.
 *
 * Let c=n*k
 * Number of full rounds is r=lcm(l,c)/c
 * So number of stops is (r*c)/l
 * or simple lcm(l,c)/l
 *
 * From a we know 2 possible startpoints. They can degenerate to 1.
 * From b we know 2 possible firststop points, can be 1.
 *
 * Find the 1 to 4 possible l and calc min/max.
 */
void solve() {
    cini(n);
    cini(k);
    cini(a);
    cini(b);

    int s1=a;
    int s2=k-a;
    if(s2<s1)
        swap(s1,s2);

    int f1=b;
    int f2=k-b;
    if(f2<f1)
        swap(f1,f2);

    int mi=1e9;
    int ma=0;
    vi d(4);
    d[0]=f1-s1;
    d[1]=f2-s1;
    d[2]=f1-s2;
    d[3]=f2-s2;

    for(int i=0; i<4; i++)  {
        while(d[i]<=0)
            d[i]+=k;
    }

    for(int j=0; j<n; j++) {
        for(int i=0; i<4; i++)  {
            int ans=lcm(d[i],n*k)/d[i];
            mi=min(mi, ans);
            ma=max(ma, ans);
            d[i]+=k;
        }
    }
    cout<<mi<<" "<<ma<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS

#include <bits/stdc++.h>
using namespace std;

int main()
{

    long long n, k, a, b;
    cin >> n >> k >> a >> b;
    long long c[4], nk = n * k;

    {
        c[0] = (a + b) % nk;
        c[1] = (a - b + nk) % nk;
        c[2] = (-a + b + nk) % nk;
        c[3] = (nk - a - b) % nk;
    }
    long long mx = LLONG_MIN, mn = LLONG_MAX;
    long long j = 4;
    while (j--)
        for (int i = 0; i <= 100; i++)
        {
            long long l = i * k + c[j];
            mx = max(mx, nk / (__gcd(l, nk)));
            mn = min(mn, nk / (__gcd(l, nk)));

        }
    cout << mn << " " << mx << endl;
}

#include <bits/stdc++.h>
using namespace std;

#define int long long

int n, k;
int a, b;

int pgcd(int a, int b) {
	return abs(__gcd(a, b));
}

int ppcm(int A, int B) {
	return (A * B) / pgcd(A, B);
}

vector<int> stops;

int fastExp(int x, int m) {
	int res=1;
	while(m>0){
		if(m%2LL)res*=x;
		x*=x;
		res*=x;
		m/=2LL;
		x%=n*k;
		res%=n*k;
	}
	return res;
}

int solve(int l, int K) {
	if(l == 0) {stops.push_back(1);return K;}
	return ppcm(l, K) / l;
}

int solve(int l) {
	for(int i = 1; i <= n; i++)
		stops.push_back(solve(l+k*i, n*k));
	return solve(l, k*n);
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cin>>n>>k>>a>>b;
	if(a == 0 and b == 0) {
		cout << 1 << " " << n << endl;
		return 0;
	}
	stops.push_back(solve(b - a));
	stops.push_back(solve(-b - a));
	stops.push_back(solve(a - b));
	stops.push_back(solve(a + b));
	sort(stops.begin(), stops.end());
	cout << stops[0] << " " << stops.back() << endl;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;

const int mn = 2e5 + 5;
const int mod = 998244353;

int n, k, a, b;
ll mini = 1e13, maxi = 0;

int main() {
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    scanf("%d%d", &n, &k);
    scanf("%d%d", &a, &b);
    ll nk = (ll) n * k;
    for (int i = 0; i <= n; i++) {
        int dist = b + i * k + a;
        if (dist != 0) {
            maxi = max(maxi, nk / gcd(dist, nk));
            mini = min(mini, nk / gcd(dist, nk));
        }
        dist = b + i * k - a;
        if (dist != 0) {
            maxi = max(maxi, nk / gcd(dist, nk));
            mini = min(mini, nk / gcd(dist, nk));
        }
    }
    for (int i = 0; i <= n; i++) {
        int dist = -b + i * k + a;
        if (dist != 0) {
            maxi = max(maxi, nk / gcd(dist, nk));
            mini = min(mini, nk / gcd(dist, nk));
        }
        dist = -b + i * k - a;
        if (dist != 0) {
            maxi = max(maxi, nk / gcd(dist, nk));
            mini = min(mini, nk / gcd(dist, nk));
        }
    }
    printf("%lld %lld\n", mini, maxi);

    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set=tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<int,ull> piu;
typedef vector<vector<int>> matrix;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=5e5+123;
const int M=1e6+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k,a,b;
    cin>>n>>k>>a>>b;
    vector<int>x,y;
    ll s=1ll*n*k;
    int z=min(n,500);
    for(int i=1;i<=z;i++){
        x.pb(k*(i-1)+a+1);
        x.pb(k*i-a+1);
        y.pb(k*(i-1)+b+1);
        y.pb(k*i-b+1);
    }
    ll mn=s,mx=1;
    for(int l : x){
        for(int r : y){
            if(l>r)continue;
            ll d=(r-l);
            d=s/__gcd(s,d);
            mn=min(d,mn);
            mx=max(mx,d);
        }
    }
    cout<<mn<<" "<<mx;
    return 0;
}

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <math.h>
#include <map>
#include <set>
#include <string>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int INT_INF = 1e9;
const ll LL_INF = 2e18;

ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}

ll n,k;
ll a,b;
int main() {
    scanf("%lld %lld", &n,&k);
    scanf("%lld %lld", &a,&b);
    ll mi=1e9, mx = -1;

 	ll l[4] = {-a-b, -a+b, a-b, b-a};
 	for(int i=0;i<=n;i++) {
 		for(int j=0;j<4;j++){
 			ll tmpl = (k*i+l[j]+k*n)%(k*n);
			ll g = gcd(n*k, tmpl);
			ll tmp = n*k/g;
			mi = min(mi, tmp);
			mx = max(mx, tmp);
		}
 	}

 	printf("%lld %lld", mi, mx);
    return 0;
}

#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
ll N,K,a,b,c,d,i,j,M,e,f,g,P,Q,R,S,T,k=i,A,L;

ll gcd(ll a , ll b){
	if(b==0)
	return a;
	else return gcd(b,a%b);
}
void solve(){
cin >> N>> K >> a >> b;
S=1+a;
Q=INT_MAX;
R=0;
P=1;
M=N*K;
while((P)<=M){
	T=P+b;
	if(T>M)
	T-=M;
	L=T-S;
	if(L<=0)
	L+=M;
	c=M/gcd(M,L);
	// d=N*K/gcd(N*K,M);
	Q=min(Q,c);
	R=max(R,c);
	P+=K;
}

P=(N-1)*K+1;
while((P)>0){
	T=P-b;
	if(T<=0)
	T+=M;
	L=T-S;
	if(L<=0)
	L+=M;
	c=M/gcd(M,L);
	Q=min(Q,c);
	R=max(R,c);
	P-=K;
}
cout << Q << " " << R << endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)(x).size()
#define ll long long
using namespace std;

ll n,k,a,b;
ll total,x,y;
ll mx[100123] , mn[100123];

void f(ll s , ll t){
      ll l = (t - s + total) % k;

      x = min(x , total / mx[l]);
      y = max(y , total / mn[l]);
}

int32_t main(){
      ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n >> k;
	cin >> a >> b;

	x = 1e18 , y = 0;
	total = n * k;

	vector<ll> d;
	for(ll i = 1; i * i <= total; ++i) if(total % i == 0) d.pb(i) , d.pb(total / i);
	sort(d.begin() , d.end());

	for(int i = 0; i <= k - 1; ++i) mn[i] = 1e18 , mx[i] = 1;
	for(ll X: d){
            mn[X % k] = min(mn[X % k] , X);
            mx[X % k] = max(mx[X % k] , X);
	}

      f(a , b);
      f(k - a , b);
      f(a , k - b);
      f(k - a , k - b);

	cout << x << ' ' << y << '\n';

      return 0;
}

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
ll __gcd(ll a, ll b) { return b ? __gcd(b, a%b) : a; }
ll y = 0, x = LLONG_MAX;
using namespace std;

void f(int start, int len, int a, int b, int k)
{
  set<int> s;
  int cur = 1;
  while (cur <= len)
  {
    auto ri = (cur + b) % len;
    if (ri == 0)
      ri = len;
    auto le = (cur - b + len) % len;
    if (le == 0)
      le = len;
    s.insert(ri);
    s.insert(le);
    cur += k;
  }
  for (auto& ss : s)
  {
    int step = abs(ss - start); // l
    if (step == 0)
      step = len;
    //int i = 1;
    //while ((step*i) % len != 0)
    //{
    //  i++;
    //}
    ll lcm = ((ll)step*(ll)len) / (ll)__gcd(step, len);
    y = max(y, lcm/(ll)step);
    x = min(x, lcm/(ll)step);
  }
}

int main()
{
  int n, k, a,b;
  scanf("%d %d", &n, &k);
  scanf("%d %d", &a, &b);
  int len = n*k;

  f(1+a, len, a, b, k);
  f((1 + len - a) % len, len, a, b, k);
  printf("%I64d %I64d\n", x, y);
  return 0;
}

#include<bits/stdc++.h>

using namespace std;

long long int gcd(long long int a, long long int b)
 {
    // Everything divides 0
    if (a == 0 || b == 0)
        return 0;

    // Base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
 }

// Function to return LCM of two numbers
  long long int lcm(long long int a, long long int b)
 {
    return (a*b)/gcd(a, b);
 }

int main()
{
    long long int n,k,a,b,d,l1,l2,l3,l4,mx=INT_MIN,mn=INT_MAX,i,v1,v2,x,s;
    vector<long long int> l;
    map<long long int,long long int> m;
   cin>>n>>k;
   cin>>a>>b;
   d=n*k;
   s=1+a;

  /* l1=a+b;
   l2=d-l1;
   l3=abs(b-a);
   l4=d-l3;*/

   for(i=1;i<=d;i=i+k)
   {
       //cout<<546<<endl;
       v1=(i-b)>0?i-b:i-b+d;
       v2=i+b;
       l1=abs(s-v1);
       l2=abs(d-l1);
       l3=abs(s-v2);
       l4=abs(d-l3);

       //cout<<l1<<" "<<l2<<" "<<l3<<" "<<l4<<endl;
       if(!m[l1] && l1!=0)
        {l.push_back(l1);m[l1]=1;}

       if(!m[l2] && l2!=0)
        {l.push_back(l2);m[l2]=1;}

        if(!m[l3] && l3!=0)
        {l.push_back(l3);m[l3]=1;}

        if(!m[l4] && l4!=0)
        {l.push_back(l4);m[l4]=1;}
   }

   //cout<<546<<endl;
   for(i=0;i<l.size();i++)
   {
       x=lcm(d,l[i])/l[i];

       //cout<<546<<endl;

       if(x>mx)
        mx=x;

       if(x<mn)
        mn=x;
   }

   cout<<mn<<" "<<mx;

    return 0;
}

#include<bits/stdc++.h>
#define For(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n,x) for(int i=m;i<n;i=i+x)
#define mem(arr,x) memset(arr,x,sizeof(arr))
#define ll long long
#define pb push_back
#define Sort(arr) sort(arr.begin(),arr.end())
using namespace std;
ll ro(ll x,ll s)
{
	/*ll te=x,i=1;
	while(te%s != 0)
	{
		te+=x;
		i++;
	}*/
	//return i;
	ll y;
	y = __gcd( x, s);
	return (s/y);
}
int main()
{
	ll n,k,m,a1,b1,ma=0,mi=INT_MAX;
	cin>>n>>k;
	cin>>a1>>b1;
	m=n*k;
	vector<ll> re,av,bv;
	set<ll> a,b;
	re.pb(1);
	while(re.size()!=n)
	{
		re.pb(re[re.size()-1]+k);
	}
	For(i,re.size())
	{
		//av.pb(re[i]+a1);
		//av.pb(re[i]-a1);
		bv.pb(re[i]+b1);
		bv.pb(re[i]-b1);
	}
	av.pb(re[0]+a1);
	ll x=av[0];
	if(x<0)
			x+=n*k;
		x%=n*k;
		if(x==0)
			x=n*k;
	av[0]=x;
	For(i,bv.size())
	{
		ll y;
		y=bv[i];
		if(y<0)
			y+=n*k;
		y%=n*k;
		if(y==0)
			y=n*k;
		bv[i]=y;
	}
	/*For(i,re.size())
	{
		a.insert(re[i]+a1);
		a.insert(re[i]-a1);
		b.insert(re[i]+b1);
		b.insert(re[i]-b1);
	}
	set<ll> :: iterator i,j;
	for(i=a.begin(),j=b.begin();i!=a.end(),j!=b.end();i++,j++)
	{
		ll x,y;
		x=*i;
		y=*j;
		if(x<0)
			x+=n*k;
		x%=n*k;
		if(x==0)
			x=n*k;
		if(y<0)
			y+=n*k;
		y%=n*k;
		if(y==0)
			y=n*k;
		av.pb(x);
		bv.pb(y);
	}*/
	ll arr[1][bv.size()];
	//For(i,av.size())
	//{
		For(j,bv.size())
		{
			arr[0][j]=min(abs(bv[j]-av[0]),abs(av[0]-bv[j]));
			if(arr[0][j]==0)
				arr[0][j]=n*k;
			ll xx=ro(arr[0][j],n*k);
			ma=max(ma,xx);
			mi=min(mi,xx);
			//ma=max(ma,(arr[i][j]*n*k)/((__gcd(n*k,arr[i][j]))*__gcd(n*k,arr[i][j])));
			//mi=min(mi,(arr[i][j]*n*k)/((__gcd(n*k,arr[i][j]))*__gcd(n*k,arr[i][j])));
		}
	//}

	cout<<mi<<" "<<ma;
}

#include <bits/stdc++.h>

using namespace std;
int gcd(int a, int b) {
    int t;
    while (a!=0) {
        t=b%a;
        b=a;
        a=t;
    }
    return b;
}
int main()
{
    //cout<<gcd(8,10);
    vector <int> vec;
    int n,k,a,b,m,pos1,c,minn=1000000,maxx=-100000,c1,c2;
    cin>>n>>k;
    cin>>a>>b;
    m=n*k;
    for (int i=0; i<min(2*k+1,m); i++) {
        vec.push_back(min(min(abs(i-k),abs(i)),abs(i-2*k)));
       //cout<<vec[i]<<' ';
    }
   // cout<<endl;
    for (int j=0; j<min(2*k+1,m); j++) {
        if (vec[j]==a) {
            pos1=j;
             for (int i=0; i<min(2*k+1,m); i++) {
                int res;

                if (vec[i]==b) {

                    if (i>pos1) {
                       // cout<<"i>pos1"<<endl;
                        c=gcd(i-pos1,m);
                        c1=(i-pos1)/c;
                        c2=m/c;
                        res=c*c1*c2/(i-pos1);

                    }
                    else {
                        //cout<<"i<pos1"<<endl;
                        c=gcd(m-pos1+i,m);
                      //  cout<<c<<' '<<m-pos1+i<<' '<<m<<endl;
                        c1=(m-pos1+i)/c;
                        c2=m/c;
                        res=c*c1*c2/(m-pos1+i);
                    }
                  // cout<<i<<' '<<pos1<<' '<<res<<endl;

                    if (res>maxx)
                        maxx=res;
                    if (res<minn)
                        minn=res;
                }
            }
        }
    }

    cout<<minn<<' '<<maxx<<endl;
    return 0;
}

#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <chrono>
#define FOR(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %ld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

const int MAXN = 100100;

int n, k, a, b;
ll m;

ll lcm (ll a_, ll b_) {
	ll c = __gcd (a_, b_);
	return a_ * b_ / c;
}

void load() {
	scanf("%d%d%d%d", &n, &k, &a, &b);
}

ll cyc (ll x) {
	while ( x < 0 ) x += m;
	return x % m;
}

vector<ll> ss;

ll x, y;

void solve1(ll s) {
	for (ll kand : ss) {
		ll cyc_ = cyc (kand - s);
		if (cyc_ == 0) cyc_ = m;
		//printf("cyc: %lld\n", cyc_);
		ll kor = lcm (cyc_, m);
		//printf("%lld %lld %lld\n", s, kand, kor);
		kor /= cyc_;
		x = min (x, kor);
		y = max (y, kor);
	}
	for (ll kand : ss) {
		ll cyc_ = cyc (s - kand);
		if (cyc_ == 0) cyc_ = m;
		//printf("cyc: %lld\n", cyc_);
		ll kor = lcm (cyc_, m);
		//printf("%lld %lld %lld\n", s, kand, kor);
		kor /= cyc_;
		x = min (x, kor);
		y = max (y, kor);
	}
}

void solve() {
	y = 0, x = 1e18;
	m = (ll) n * k;
	for (ll i = 0; i < m; i += k) {
		ll pret = cyc (i - b), nex = cyc (i + b);
		ss.push_back (pret);
		ss.push_back (nex);
	}
	ll pret = cyc (0 - a), nex = cyc (0 + a);
	solve1 (pret); solve1 (nex);
	printf("%lld %lld\n", x, y);
}

int main() {
	load();
	solve();
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n,k,a,b;
	cin>>n>>k>>a>>b;
	ll l1=a+b;
	ll l2=abs(a-b);
	ll l3=k-abs(a-b);
	ll l4=k-a-b;
	queue <ll> q;
	while(l1<=k*n){
		if(l1!=0) q.push(l1);
		l1+=k;
	}
	while(l2<=k*n){
		if(l2!=0) q.push(l2);
		l2+=k;
	}
	while(l3<=k*n){
		if(l3!=0) q.push(l3);
		l3+=k;
	}
	while(l4<=k*n){
		if(l4!=0) q.push(l4);
		l4+=k;
	}
	ll maxn=-1,minn=1e9+7;
	while(!q.empty()){
		ll t=q.front();
		ll ti=(t*n*k/__gcd(t,n*k))/t;
		maxn=max(ti,maxn);
		minn=min(ti,minn);
		q.pop();
	}
	cout<<minn<<" "<<maxn<<endl;
}

#include<iostream>
#include<algorithm>
using namespace std;
long long  n,k,a,l,b,ans1,ans2=(int)(1e9+1000);
long long gcd(int x,int y){
	if(y==0)return x;
	else{return gcd(y,x%y);}
}
int main(){
	cin>>n>>k>>a>>b;
	long long c[10];
	c[1]=a+b;c[2]=a-b;c[3]=-a-b;c[4]=-a+b;
	for(long long i=1;i<=n;i++){
		for(long long j=1;j<=4;j++){
			long long l=i*k+c[j];
			long long ans=n*k/gcd(l,n*k);
			ans1=max(ans1,ans);
			ans2=min(ans2,ans);
		}
	}
	cout<<ans2<<' '<<ans1;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <stack>
#include <deque>
#include <memory.h>
#include <string>
#include <unordered_map>

#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vI vector<int>
#define vvI vector<vector<int>>
#define vLL vector<ll>
#define vS vector<string>
#define fori(i, n) for(int (i)=0; (i)<n; (i)++)
#define forn(it,from,to) for(int (it)=from; (it)<to; (it)++)
#define forI(tmp) for(auto(it)=(tmp).begin();(it)!=(tmp).end();(it)++)
#define PI 3.14159265356
#define LD long double
#define sc(a) scanf("%d", &(a))
#define scc(a) scanf("%lld", &(a))
#pragma comment (linker, "/STACK:5000000000")
typedef long long ll;

const ll mod = 1000000007;
ll Inf = (ll)2e9;
ll LINF = (ll)1e18 + 1e17;

using namespace std;

ll n, k;

ll get_dist(ll x)
{
	ll ost = (x - 1) % k;
	return min(ost, k - ost);
}

ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	cin >> n >> k;
	ll d = n * k;
	ll a, b;
	cin >> a >> b;
	ll fir = a + 1, sec = k + 1 - a;

	ll ans_min = LINF, ans_max = 0;
	for (ll i = 1; i <= n; i++)
	{
		ll g;
		ll need_d;
		ll l, d1, d2;
		l = k * i + (a + b) % k;
		g = gcd(d, l);
		need_d = d * l / g;
		d1 = get_dist(fir + l), d2 = get_dist(sec + l);
		if (d1 == b || d2 == b)
		{
			ans_min = min(ans_min, need_d / l);
			ans_max = max(ans_max, need_d / l);
		}

		l = k * i + (a - b) % k;
		g = gcd(d, l);
		need_d = d * l / g;
		d1 = get_dist(fir + l), d2 = get_dist(sec + l);
		if (d1 == b || d2 == b)
		{
			ans_min = min(ans_min, need_d / l);
			ans_max = max(ans_max, need_d / l);
		}

		l = k * i + (-a + b) % k;
		g = gcd(d, l);
		need_d = d * l / g;
		d1 = get_dist(fir + l), d2 = get_dist(sec + l);
		if (d1 == b || d2 == b)
		{
			ans_min = min(ans_min, need_d / l);
			ans_max = max(ans_max, need_d / l);
		}
		l = k * i + (-a - b) % k;
		g = gcd(d, l);
		need_d = d * l / g;
		d1 = get_dist(fir + l), d2 = get_dist(sec + l);
		if (d1 == b || d2 == b)
		{
			ans_min = min(ans_min, need_d / l);
			ans_max = max(ans_max, need_d / l);
		}

	}

	cout << ans_min << " " << ans_max;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
	ll out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
ll n,k,a,b,K;
ll gcd(ll A,ll B)
{
	return B?gcd(B,A%B):A;
}
ll calc(ll l)
{
	ll p=gcd(l,n*K);
	return n*K/p;
}
ll p[4];
int main()
{
	n=read(),k=read(),a=read(),b=read();
	p[0]=(k+a+b)%k;
	p[1]=(k+a-b)%k;
	p[2]=(k-a-b)%k;
	p[3]=(k-a+b)%k;
	ll maxans=0,minans=1e18;
	for(int i=0;i<4;++i)
	{
		ll y=gcd(p[i],k);
		p[i]/=y;
		K=k/y;
		ll l1=y;
		ll l2=y*gcd(n,p[i]);
		ll ans1=calc(l1),ans2=calc(l2);
		maxans=max(maxans,max(ans1,ans2));
		minans=min(minans,min(ans1,ans2));
	}
	cout<<minans<<' '<<maxans<<endl;
	return 0;
}

#include<bits/stdc++.h>
#include<cmath>
using namespace std;

#define ll long long
#define endl "\n"

ll n,k,a,b;

ll get(ll hm){
    if(hm==0){
        return 1;
    }
    ll L=(n*k)/__gcd(n*k,hm);
    return L;
}

int main(){
    ios_base::sync_with_stdio(false);

    cin>>n>>k>>a>>b;

    ll mn=1e9,mx=0;

    for(ll r=0;r<=n;r++){
        ll hm=r*k;
        ll len=hm+a+b;
        if(len>0){
            mn=min(mn,get(len)), mx=max(mx,get(len));
            if(mn==-3){
                cout<<len<<endl;
            }
        }
        len=hm-a-b;
        if(len>0){
            mn=min(mn,get(len)), mx=max(mx,get(len));
            if(mn==-3){
                cout<<len<<endl;
            }
        }
        len=hm-a+b;
        if(len>0){
            mn=min(mn,get(len)), mx=max(mx,get(len));
            if(mn==-3){
                cout<<len<<endl;
            }
        }
        len=hm-b+a;
        if(len>0){
            mn=min(mn,get(len)), mx=max(mx,get(len));
            if(mn==-3){
                cout<<len<<endl;
            }
        }
    }

    cout<<mn<<" "<<mx<<endl;
    return 0;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    int n,k; cin>>n>>k;
    int a,b; cin>>a>>b;
    int x=1e6+10;
    int y=0;
    int mod=n*k;
    for(int i=0;i<n;i++)
    {
        int c=(a+b)+i*k;  //cout<<c<<"  ";
        int f=__gcd(c%mod,n*k);
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
        c=k-a+b+i*k;     // cout<<c<<"  ";
        f=__gcd(c%mod,n*k);
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
        c=k-b+a+i*k;     // cout<<c<<"  ";
        f=__gcd(c%mod,n*k);
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
        c=k-b+k-a+i*k;   // cout<<c<<"  "; cout<<endl;
        f=__gcd(c%mod,n*k);
        if(f!=0) {f=n*k/f; x=min(x,f); y=max(y,f); }
    }
    cout<<x<<" "<<y<<endl;
}

#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T,typename... Args>
void err(istream_iterator<string>it,T a,Args... args)
{
	cerr<<*it<<"= " <<a<<" ";
	err(++it,args...);
}
ll multiply(ll a,ll b)
{
    ll res=0;
    while(b>0)
    {
        if(b&1)
            res+=a;
        b/=2;
        a=(2*a);
    }
    return res;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n,k; cin>>n>>k;
  int a,b; cin>>a>>b;
  ll p=multiply(n,k);
  ll res1=INT_MAX,res2=INT_MIN;
  vector<int>c={a+b,a-b,b-a,-a-b};
  rep(i,1,n)
  {
  	for(auto j:c)
  	{
  	    ll l= multiply(k,i)+j;
		ll  moves=(p)/__gcd(p,l);
		res1=min(res1,moves); res2=max(res2,moves);
	}
  }
  cout<<res1<<" "<<res2<<"\n";
  return 0;
}

//#include "stdafx.h"
#include "stdlib.h"
#include <iostream>
#include "string"
#include <algorithm>
using namespace std;

int main()
{
	int n = 0, k = 0, a = 0, b = 0, x = 0, y = 0;
	cin >> n>> k>> a>> b;

	int *ResArray, *InitArray, *StopArray;

	ResArray = (int*)malloc(n * k * sizeof(int));
	InitArray = (int*)malloc(n * k * sizeof(int));
	StopArray = (int*)malloc(n * k * sizeof(int));

	for (int m = 0; m < n*k; m++) {
		InitArray[m] = 0;
		StopArray[m] = 0;
		ResArray[m] = 0;
	}

	for (int m = 0; m < n; m++) {
		ResArray[m * k] = 1;//is the restaurant
	}

	for (int m = 0; m < n*k; m++) {
		if (ResArray[m] == 1) {
			InitArray[(m + a + 6) % 6] = 1;
			InitArray[(m - a + 6) % 6] = 1;
		}
	}

	for (int m = 0; m < n*k; m++) {
		if (ResArray[m] == 1) {
			StopArray[(m + b + 6) % 6] = 1;
			StopArray[(m - b + 6) % 6] = 1;
		}
	}

	/*
	for (int m = 0; m < n*k; m++) {
		cout <<ResArray[m]<<' '<< InitArray[m] << ' ' << StopArray[m] << '\n';
	}
	*/

	bool isFirst = true;
	//x:min ,y:max
	int JumpCount = 1;
	int JumpDistance = 0;

	for (int m = 0; m < n*k; m++)
	{
		for (int j = 0; j < n*k; j++) {
			if (InitArray[m] == 1 && StopArray[j] == 1)
			{
				if (abs(m - j) == 0) {
					JumpDistance = n * k;
				}
				else
					JumpDistance = abs(m - j);

				//cout <<"m:"<< m <<"j:"<< j<<'\n';

				//cout << JumpDistance << "\n\n";

				while ((JumpCount * JumpDistance) % (n*k) != 0) {
					JumpCount++;
				}

				if (isFirst) {
					isFirst = !isFirst;
					x = JumpCount;
					y = JumpCount;
				}

				JumpCount = 1;

				if (JumpDistance != n * k) {
					JumpDistance = n * k - JumpDistance;

					while ((JumpCount * JumpDistance) % (n*k) != 0) {
						JumpCount++;
					}
				}
				x = min(JumpCount, x);
				y = max(JumpCount, y);

				//cout << JumpDistance<<'\n';

				JumpCount = 1;
			}

		}

	}

	cout << x<<' '<< y;
//	system("pause");
    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
long long n,k;
long long  a,b;
long long gcd(long long x,long long y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}
long long lcm(long long x,long long y){
	return x*y/gcd(x,y);
}
int main(){
	cin>>n>>k>>a>>b;
	long long ans_min=2e18;
	long long ans_max=0;
	for(long long i=1;i<=n;i++){
		long long l1=i*k+b-a;
		long long l2=i*k-b-a;
		if(l1!=0){
			long long tim1=lcm(n*k,l1)/l1;
			ans_max=max(ans_max,tim1);
			ans_min=min(ans_min,tim1);
		}
		if(l2!=0){
			long long tim2=lcm(n*k,l2)/l2;
			ans_max=max(ans_max,tim2);
			ans_min=min(ans_min,tim2);
		}
	}
	cout<<ans_min<<" "<<ans_max<<endl;
	return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
long int mx = 1L, mn, p;
void f(long int l)
{
    long int s = p/__gcd(p,l);
    mx = max(mx, s);
    mn = min(mn, s);
}
main()
{
    int n,k;
    cin>>n>>k;
    p = n*k;
    mn = p;
    int a,b;
    cin>>a>>b;

    long int l = 0L;
    for(long int i=0;i<n;++i)
    {
        l = i*k+a+b;
        f(l);

        l = (i+1)*k-a-b;
        f(l);

        l = (i+1)*k+a-b;
        f(l);

        l = (i+1)*k-a+b;
        f(l);
    }
    cout<<mn<<" "<<mx;
}

#include<bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<string> vs;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<pair<string, ll> > vsi;
typedef set<ll> si;
typedef map<ll, ll> mii;
typedef map<string, ll> msi;
typedef tuple<ll, ll, ll> ti;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}

#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}

inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }

template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}

#define pb push_back
#define mk make_pair
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define mod 1000000007
#define ff first
#define ss second

//Loops
#define REP(i, b) for(ll i=0; i<(ll)(b); i++)
#define F(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define FD(i, a, b) for(ll i=(ll)(a); i>=(ll)(b); i--)

#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define RTIME(start, end) ((double)(end-start)/(double)CLOCKS_PER_SEC)
#define D(a) cout<<a<<endl
#define MAX 200007
#define INF 1e18

struct edge
{
    ll a, b, cost;
    edge(ll x, ll y, ll z):a(x), b(y), cost(z) {};
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main()
{
    fastio()

    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll n, k, a, b;
    cin>>n>>k>>a>>b;
    vi pos;
    ll diff=abs(a-b);
    F(i, 1, n)
    {
        pos.pb(i*k + diff);
        pos.pb(i*k - diff);
        pos.pb(i*k + (k-a-b));
        pos.pb(i*k - (k-a-b));
    }

    ll mini=INT_MAX, maxi=0;
    for(auto elem : pos)
    {
        ll kg=gcd(n*k, elem);
        ll moves=(n*k)/kg;
        mini=min(mini, moves);
        maxi=max(maxi, moves);
    }

    cout<<mini<<" "<<maxi<<endl;

    return 0;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int         long long int
#define ld          long double
#define lop(i,a,b)  for(int i=a;i<b;i++)
#define rlop(i,b,a) for(int i=b-1;i>=a;i--)
#define nl          '\n'
#define pb          push_back
#define F           first
#define S           second
#define pii         pair<int,int>
#define vi          vector<int>
#define vpi         vector<pii>
#define mii         map<int,int>
#define umii        unordered_map<int,int>
#define si          set <int>
#define spi         set <pii>
#define usi         unordered_set<int>
#define que_max     priority_queue <int>
#define que_min     priority_queue <int,vi,greater<int>>
#define clr(x)      x.clear()
#define all(p)      p.begin(),p.end()
#define mset(a,b,c) lop(i,0,c) a[i]=b
#define minimum(a)  *min_element(a.begin(), a.end())
#define maximum(a)  *max_element(a.begin(), a.end())
#define bug(...)    __f(#__VA_ARGS__, __VA_ARGS__)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<pii, null_type, less<pii>, rb_tree_tag,
        tree_order_statistics_node_update> new_set;

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << std::endl; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

const int N=100005;
int a[N];
vi v,ans;

void solve()
{
     int n,m,k,a,b;
     cin>>n>>k;
     cin>>a>>b;
     m=n*k;
     for(int i=1;i*i<=m;i++)
     {
          if(m%i==0)
          {
               v.pb(i);
               if(i*i!=m) v.pb(m/i);
          }
     }
     int s1=1+a;
     int s2=1+k-a;
     // bug(s1,s2);
     for(auto xx:v)
     {
          int aa=(s1+xx)%m;
          if(aa==0) aa=m;
          int bb=(s1-xx+m)%m;
          if(bb==0) bb=m;
          int x=(aa+b)%m,y=(aa-b+m)%m;
          // bug(xx,aa,bb,x,y);
          if((x-1)%k==0 || (y-1)%k==0) ans.pb(xx);
          x=(bb+b)%m,y=(bb-b+m)%m;
          if((x-1)%k==0 || (y-1)%k==0) ans.pb(xx);
     }
     for(auto xx:v)
     {
          int aa=(s2+xx)%m;
          if(aa==0) aa=m;
          int bb=(s2-xx+m)%m;
          if(bb==0) bb=m;
          int x=(aa+b)%m,y=(aa-b+m)%m;
          if((x-1)%k==0 || (y-1)%k==0) ans.pb(xx);
          x=(bb+b)%m,y=(bb-b+m)%m;
          if((x-1)%k==0 || (y-1)%k==0) ans.pb(xx);
     }
     sort(all(ans));
     cout<<m/ans.back()<<" "<<m/ans[0];
}

int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt",  "r",  stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt",  "w", stderr);
#endif
    solve();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define int long long

int n, k;
int a, b;

int pgcd(int a, int b) {
	return abs(__gcd(a, b));
}

int ppcm(int A, int B) {
	return (A * B) / pgcd(A, B);
}

vector<int> stops;

int fastExp(int x, int m) {
	int res=1;
	while(m>0){
		if(m%2LL)res*=x;
		x*=x;
		res*=x;
		m/=2LL;
		x%=n*k;
		res%=n*k;
	}
	return res;
}

int solve(int l, int K) {
	if(l == 0) {stops.push_back(1);return K;}
	return ppcm(l, K) / l;
}

int solve(int l) {
	for(int i = 1; i <= n; i++)
		stops.push_back(solve(l+k*i, n*k));
	return solve(l, k*n);
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cin>>n>>k>>a>>b;
	if(a == 0 and b == 0) {
		cout << 1 << " " << n << endl;
		return 0;
	}
	stops.push_back(solve(b - a));
	stops.push_back(solve(-b - a));
	stops.push_back(solve(a - b));
	stops.push_back(solve(a + b));
	sort(stops.begin(), stops.end());
	cout << stops[0] << " " << stops.back() << endl;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

int n;
ll k,a,b;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  cin>>n>>k;
  cin>>a>>b;

  ll m=1LL*n*k;

  set<ll> starts, ends;
  starts.insert(0 + a);
  starts.insert((k-a)%m);

  for (int i=0; i<(int)k; i++) {
    ends.insert(i*k+b);
    ends.insert((1LL*k*(i+1) - b)%m);
  }

  set<ll> lens;
  for (auto s: starts) {
    for (auto e: ends) {
      lens.insert((e-s+m)%m);
    }
  }

  ll x=1e9;
  ll y=-1;

  for (auto l: lens) {
    if (l==0) {
      x=min(x,1LL);
      y=max(y,1LL);
      continue;
    }
    ll lcm = (l*m)/__gcd(l,m);
    ll dst = lcm/l;
    x=min(x,dst);
    y=max(y,dst);
  }

  cout<<x<<" "<<y<<endl;

  return 0;
}

#include <bits/stdc++.h>
#define maxn 100005
#define ll long long
#define mod 1000000007
using namespace std;
int n, k;
ll gcd(ll a, ll b)
{
	if(!b) return a;
	return gcd(b, a % b);
}
int main()
{
	int n, k, a, b;
	cin>>n>>k>>a>>b;
	int pl = a + 1;
	ll t = 1ll * n * k;
	ll mxs = 1, mns = t;
	for(int i = 1; i <= n; i++)
	{
		ll ns = 1ll * (i - 1) * k + 1 + b;
		mxs = max(mxs, gcd(t, t + ns - pl));
		mns = min(mns, gcd(t, t + ns - pl));
		ns = (i - 1) * k + 1 - b;
		mxs = max(mxs, gcd(t, t * 2 + ns - pl));
		mns = min(mns, gcd(t, t * 2 + ns - pl));
	}
	cout<<t / mxs<<" "<<t / mns<<endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

struct sol{
	ll mi=100001, ma=-1;
};

ll n, k;

ll gcd(ll a, ll b)
{
	if(a<b) swap(a, b);
	while(b)
	{
		a = a%b;
		swap(a, b);
	}
	return a;
}

ll getL(ll uno, ll due)
{
	return abs(uno-due);
}

ll compute(ll l)
{
	return n*k/gcd(n*k, l);
}

sol solve(int a, int b)
{
	ll s1 = a;
	ll s2 = b;
	ll delta_first1 = k-a-b, delta_second1 = k+2*b;
	ll delta_first2 = k+2*b, delta_second2 = k-a-b;
	sol ret;
	for(int i=0; i<n; i++)
	{
		s1 += delta_first1;
		s2 += delta_first2;
		ll att1 = compute(getL(s1, a));
		ll att2 = compute(getL(s2, b));
		if(att1 < ret.mi)
			ret.mi = att1;
		if(att1 > ret.ma)
			ret.ma = att1;
		if(att2 < ret.mi)
			ret.mi = att2;
		if(att2 > ret.ma)
			ret.ma = att2;

		s1 += delta_second1;
		s2 += delta_second2;
		att1 = compute(getL(s1, a));
		att2 = compute(getL(s2, b));
		if(att1 < ret.mi)
			ret.mi = att1;
		if(att1 > ret.ma)
			ret.ma = att1;
		if(att2 < ret.mi)
			ret.mi = att2;
		if(att2 > ret.ma)
			ret.ma = att2;
	}
	return ret;
}

ll a, b, s;

int main(){

	cin >> n >> k >> a >> b;
	s = a+1;
	sol r = solve(a, b);
	cout << r.mi << " " << r.ma;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define mod 10000009
#define pb push_back
typedef long long ll;
typedef long double ld;
//#define max 1000001
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)

vector<int> maxi(int a){
    vector<int> v;
    while(a!=0){
        v.pb(a%10);
        a=a/10;
    }
    return v;
}

ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}

int main(){
    ios_base::sync_with_stdio(false);
    ll n,k,a,b;
    cin >> n >> k >> a >> b;
    set<ll> l;
    for(ll i=k;i<(n)*k;i+=k){
        if(i+b-a)l.insert((i+b-a));
        if(i-b-a)l.insert((i-b-a));
        if(i+b+a)l.insert((i+b+a));
        if(i-b+a)l.insert((i-b+a));
    }
    ll maxi = 0;
    ll mini = INT_MAX;
    for(auto it = l.begin();it!=l.end();++it){
        if(maxi<(n*k)/gcd(*it,n*k)){
            maxi = (n*k)/(gcd(*it,n*k));
        }
        if(mini>(n*k)/gcd(*it,n*k)){
            mini = (n*k)/(gcd(*it,n*k));
        }
    }
    cout << mini << " " << maxi << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define debug(a) cerr << #a << " = " << (a) << endl;
#define get(t, i) get<(i)>((t))
#define fst first
#define snd second
#define all(X) begin(X), end(X)

template<typename T> ostream& operator<<(ostream& o, const vector<T>& v) {
  o << '['; int b = 0; for (const auto& a : v) o << (b++ ? ", " : "") << a; o << ']'; return o;
}

template<typename T, typename U> ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << '(' << p.fst << ", " << p.snd << ')'; return o;
}

template<typename T> ostream& operator<<(ostream& o, const set<T>& s) {
  o << '{'; int b = 0; for (auto& e : s) o << (b++ ? ", " : "") << e; o << '}'; return o;
}

int n, k, a, b, x, y;

int d(int s, int t) {
  return abs(s-t) % (n*k);
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  cin >> n >> k >> a >> b;

  x = n*k;
  int s = a;
  for (int l = b; l <= n*k; l += k) x = min(x, (n*k)/__gcd(d(s, l), n*k));
  for (int l = k-b; l <= n*k; l += k) x = min(x, (n*k)/__gcd(d(s, l), n*k));
  for (int l = b; l <= n*k; l += k) y = max(y, (n*k)/__gcd(d(s, l), n*k));
  for (int l = k-b; l <= n*k; l += k) y = max(y, (n*k)/__gcd(d(s, l), n*k));
  s = k-a;
  for (int l = b; l <= n*k; l += k) x = min(x, (n*k)/__gcd(d(s, l), n*k));
  for (int l = k-b; l <= n*k; l += k) x = min(x, (n*k)/__gcd(d(s, l), n*k));
  for (int l = b; l <= n*k; l += k) y = max(y, (n*k)/__gcd(d(s, l), n*k));
  for (int l = k-b; l <= n*k; l += k) y = max(y, (n*k)/__gcd(d(s, l), n*k));

  cout << x << ' ' << y << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
ll gcd(ll a,ll b)
{
	//Write your code here
    if(b==0)
        return a;
    return gcd(b,a%b);
}

void find(int n,int k,int a,int b,int &maxi,int &mini)
{ int s=b;
    while(s<n*k)
{
    int val=(s-a);
    if(val<0)
        val+=k;
    if(val==0)
    {
mini=min(mini,1ll);
maxi=max(maxi,1ll);
      s+=k;
        continue;
    }
    int x=gcd(n*k,val);
    int r=(n*k)/x;
     maxi=max(maxi,r);
     mini=min(mini,r);
    s+=k;
}

}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int a,b;
cin>>a>>b;
int maxi=INT_MIN;
int mini=INT_MAX;
find(n,k,a,b,maxi,mini);
find(n,k,a,k-b,maxi,mini);
find(n,k,k-a,b,maxi,mini);
find(n,k,k-a,k-b,maxi,mini);
cout<<mini<<" "<<maxi<<endl;

    return 0;
}

/*input
1 10
5 3
*/
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define f first
#define s second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
int const mod = 1e9+7;
int power(int x, int y, int mod = 2e18){ int ans = 1;x %= mod;while(y){if(y&1)ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
int gcd(int a , int b){if(a==0)return b;return gcd(b%a,a);}
int n,k,a,b;
bool check2(int dis){
  if(dis>n*k){
    dis-=n*k;
  }
  for(int i=0;i<n;i++){
    if(i*k+1 == dis){
      return 1;
    }
  }
  return 0;
}
bool check(int l){
  int pos1 = 1 + a ;
  int pos2 = k + 1 - a;
  if(check2(pos1+l-b))
  {
    return 1 ;
  }
  if(check2(pos1 + l + b) && pos1 + l + b - n*k < pos1 ){
    return 1 ;
  }
  if(check2(pos2+l-b))
    return 1 ;
  if(check2(pos2 + l + b) && pos2 + l + b - n*k < pos2)
    return 1;
  return 0;
}
signed main() {
  IOS;

  cin>>n>>k;
  cin>>a>>b;
  set<int> s;
  for(int i=1;i*i<=n*k;i++){
    if((n*k)%i)continue;
    s.insert(n*k/i);
    s.insert(i);
  }
  int mn = n*k , mx = n*k;
  vector<int> v;
  for(auto x : s){
    v.pb(x);
  }

  for(auto x : v)
  {
    if(check(x)){
      mn = x ;
      break;
    }
  }
  for(int i=v.size()-1;i>=0;i--){
    if(check(v[i])){
      mx = v[i];
      break;
    }
  }
  cout << (n*k)/mx << " " << (n*k)/mn  ;
return 0;
}

#include <bits/stdc++.h>
#define LL long long
#define pb push_back
using namespace std;
const int INF = 0x3f3f3f3f;
LL n, k, a, b;
LL t;
LL gcd(LL x, LL y){
	if(y == 0) return x;
	return gcd(y, x%y);
}
void f(LL s, LL& minX, LL& maxX){
	for(LL i = 0; i < n; i++){
		LL x1 = i*k + b, x2 = ((i+1)*k - b + t)%t;
		LL l1, l2;
		if(s < x1) l1 = x1 - s;
		else l1 = t - s + x1;

		if(s < x2) l2 = x2 - s;
		else l2 = t - s + x2;

		minX = min(minX*1LL, min(t/gcd(t,l1), t/gcd(t,l2)));
		maxX = max(maxX*1LL, max(t/gcd(t,l1), t/gcd(t,l2)));
	}
}
int main(){
	scanf("%lld %lld %lld %lld", &n, &k, &a, &b);
	t = n*1LL*k;
	LL minX = INF, maxX = -INF;
	f(a, minX, maxX); f(k-a, minX, maxX);
	printf("%lld %lld\n", minX, maxX);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define int long long

int n, k;
int a, b;

int pgcd(int a, int b) {
	return abs(__gcd(a, b));
}

int ppcm(int A, int B) {
	return (A * B) / pgcd(A, B);
}

vector<int> stops;

int fastExp(int x, int m) {
	int res=1;
	while(m>0){
		if(m%2LL)res*=x;
		x*=x;
		res*=x;
		m/=2LL;
		x%=n*k;
		res%=n*k;
	}
	return res;
}

int solve(int l, int K) {
	if(l == 0) {stops.push_back(1);return K;}
	return (n*k)/pgcd(l, K);
}

int solve(int l) {
	for(int i = 0; i <= n; i++)
		stops.push_back(solve(l+k*i, n*k));
	return solve(l, k*n);
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cin>>n>>k>>a>>b;
	if(a == 0 and b == 0) {
		cout << 1 << " " << n << endl;
		return 0;
	}
	stops.push_back(solve(b - a));
	stops.push_back(solve(-b - a));
	stops.push_back(solve(a - b));
	stops.push_back(solve(a + b));
	sort(stops.begin(), stops.end());
	cout << stops[0] << " " << stops.back() << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define int ll
#define debug cout<<"fuck"<<endl;
#define pb  push_back
const int mod=(int)1e9+7;
const int maxn=(int)1e5+5;
ll quick_pow_mod(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b & 1)
        {
            res=(res*a)%c;
        }
        a=(a*a)%c;
        b=b>>1;
    }
    return res;
}
int n,k;
int a,b;

int dis(int l)
{
    return (n*k*l)/__gcd(n*k,l)/l;
}

signed main()
{
    IOS
    cin>>n>>k;
    cin>>a>>b;
    int maxn=-1;
    int minn=(int)1e11;
    int maxx=n*k;
    int ans;
    for(int i=1;i*k-a-b<=maxx&&i<n;i++)
    {
        if (i*k-a-b>=1&&i*k-a-b<=maxx)
        {
            ans = dis(i*k-a-b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=1;i*k+a+b<=maxx&&i<n;i++)
    {
        if (i*k+a+b>=1&&i*k+a+b<=maxx)
        {
            ans = dis(i*k+a+b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=1;i*k-a+b<=maxx&&i<n;i++)
    {
        if (i*k-a+b>=1&&i*k-a+b<=maxx&&a+1)
        {
            ans = dis(i*k-a+b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    for(int i=1;i*k+a-b<=maxx&&i<n;i++)
    {
        if (i*k+a-b>=1&&i*k+a-b<=maxx)
        {
            ans = dis(i*k+a-b);
            minn = min(ans, minn);
            maxn = max(ans, maxn);
        }
    }

    cout<<minn<<' '<<maxn<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

ll gcd(ll a, ll b)
{
	if(b==0)
		return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b)
{
	ll gc = gcd(a, b);

	ll x = a/gc;
	x = x*b;

	return x;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n,k;
    cin >> n >> k;

    ll a,b;
    cin >> a >> b;

    ll x = 1+a;

    ll maxi = 0;
    ll mini = INF;

    fr(i,0,n-1)
    {
        ll kk = i*k + 1;

        ll num1 = kk-b;

        ll num2 = kk+b;

        ll ans1 = -1;
        ll ans2 = -1;

        // cout << num1 << " " << num2 << endl;
        if(num1>0 && num1<=n*k)
        {
            if(num1>x)
            {
                ll diff2 = num1-x;
                ll xx2 = lcm(diff2,n*k);
                ans1 = xx2/diff2;
            }
            else if(num1<x)
            {
                ll diff2 = num1-x+(n*k);
                ll xx2 = lcm(diff2,n*k);
                ans1 = xx2/diff2;
            }
            else
                ans1 = 1;
        }
        if(num2>0 && num2<=n*k)
        {
            if(num2>x)
            {
                ll diff2 = num2-x;
                ll xx2 = lcm(diff2,n*k);
                ans2 = xx2/diff2;
            }
            else if(num2<x)
            {
                ll diff2 = num2-x+(n*k);
                ll xx2 = lcm(diff2,n*k);
                ans2 = xx2/diff2;
            }
            else
                ans2 = 1;
        }

        if(ans1!=-1)
        {
            maxi = max(maxi,ans1);
            mini = min(mini,ans1);
        }
        if(ans2!=-1)
        {
            maxi = max(maxi, ans2);
            mini = min(mini, ans2);
        }
    }

    if(a!=0)
        x = 1-a+(n*k);

    fr(i,0,n-1)
    {
        ll kk = i*k + 1;

        ll num1 = kk-b;

        ll num2 = kk+b;

        ll ans1 = -1;
        ll ans2 = -1;

        // cout << num1 << " " << num2 << endl;
        if(num1>0 && num1<=n*k)
        {
            if(num1>x)
            {
                ll diff2 = num1-x;
                ll xx2 = lcm(diff2,n*k);
                ans1 = xx2/diff2;
            }
            else if(num1<x)
            {
                ll diff2 = num1-x+(n*k);
                ll xx2 = lcm(diff2,n*k);
                ans1 = xx2/diff2;
            }
            else
                ans1 = 1;
        }
        if(num2>0 && num2<=n*k)
        {
            if(num2>x)
            {
                ll diff2 = num2-x;
                ll xx2 = lcm(diff2,n*k);
                ans2 = xx2/diff2;
            }
            else if(num2<x)
            {
                ll diff2 = num2-x+(n*k);
                ll xx2 = lcm(diff2,n*k);
                ans2 = xx2/diff2;
            }
            else
                ans2 = 1;
        }

        if(ans1!=-1)
        {
            maxi = max(maxi,ans1);
            mini = min(mini,ans1);
        }
        if(ans2!=-1)
        {
            maxi = max(maxi, ans2);
            mini = min(mini, ans2);
        }
    }

    cout << mini << " " << maxi << endl;
}

#include <iostream>

int euclid(int a, int b)
{
	int r = a % b;
	if (r)
		return euclid(b, r);
	return b;
}

int getcur(int l, int k, int n)
{
	int i;
	int li = 0;
	for (i = 0; li != n*k; i++)
	{
		li %= k*n;
		li += l;
	}
	return i;
}

int main()
{
	int n, k, a, b;
	std::cin >> n >> k >> a >> b;

	/*while (std::cin >> a)
	{
		std::cout << getcur(a, k, n) << std::endl;
	}*/
	/*for (int i = 1; i < k*n; i++)
	{
		std::cout << i << ' ' << getcur(i, k, n) << ' ' << n*k / euclid(i, k*n) << '\n';
	}*/
	//return 0;

	int bestx = 999999999;
	int besty = 0;

	for (int ni = 0; ni <= n; ni++)
	{
		int f[2] = {
			ni*k+b-a,
			ni*k-b-a
		};
		for (auto l : f)
		{
			if (l <= 0 || l > n*k)
				continue;

			//int cur = l * k / euclid(l,k);
			//int cur = getcur(l, k, n);
			int cur = n*k / euclid(l, k*n);
			#ifdef DBG
				std::cerr << cur << ' ' << l << '\n';
			#endif
			if (cur < bestx)
			{
				bestx = cur;
			}
			if (cur > besty)
			{
				besty = cur;
			}
		}
	}

	std::cout << bestx << ' ' << besty << std::endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define FOR0(a,b) for(int i = a; i < b; ++i)
#define FORE(a,b) for(int i = a; i <= b; ++i)
typedef long long ll;
typedef pair<int,int> pii;

int gcd(int a, int b) {
	return b == 0 ? a: gcd(b,a%b);
}
int c[5];
int main() {
	ll n,k;
	cin >> n >> k;
	int a,b;
	cin >> a >> b;
	ll tot = n*k;
	c[1] = (a+b)%k;
	c[2] = (a-b)%k;
	c[3] = (-a-b)%k;
	c[4] = (-a+b)%k;
	if(c[2] <= 0) c[2] += k;
	if(c[3] <= 0) c[3] += k;
	if(c[4] <= 0) c[4] += k;

	ll ans1 = 100000000, ans2 = 0;
	for(int i = 0; i < n; ++i) {
		for(int j = 1; j <= 4; ++j) {
			ll l = 1ll*i*k+c[j];
			ll t = tot/__gcd(tot,l);
			ans1 = min(ans1,t);
			ans2 = max(ans2,t);
		}
	}
	cout << ans1 <<" " << ans2 << endl;
	return 0;
}

#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;

ll n, k;
int a, b;
vector<int> v;

ll gcd(ll x, ll y) {
	if (x < y) swap(x, y);
	if (y == 0) return x;
	return gcd(y, x%y);
}

int main () {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k >> a >> b;
	for (int i = 0; i < n; i ++) {
		for (int j = -1; j <= 1; j += 2) {
			for (int j2 = -1; j2 <= 1; j2 += 2) {
				ll tren = i;
				tren *= k;
				tren += (a*j+b*j2)%k;
				while (tren < 0) tren += k;
				v.push_back(n*k/gcd(n*k, tren));
			}
		}
	}

	sort(v.begin(), v.end());
	cout << v[0] << " " << v[(int)v.size()-1];

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
ll mod;
ll n,k;
ll ma = 0,mi = 0x3f3f3f3f;
void cal(ll e,ll s){
	ll l = (e-s+mod)%mod;
	// if(l<0||mod<0) cout << e << ' ' << s << endl;
	if(l == 0) l = mod;
	ll st = l / __gcd(l,mod) * mod / l;
	// if(st < 0) cout << l << ' ' << mod << ' ' << __gcd(l,mod) << endl;
	// cout << s << ' ' << e << ' ' << l << ' ' << st << endl;
	ma = max(ma,st);
	mi = min(mi,st);
	l = mod - l;
	// if(l<0||mod<0) cout << e << ' ' << s << endl;
	if(l == 0) l = mod;
	st = l / __gcd(l,mod) * mod / l;
	// cout << s << ' ' << e << ' ' << l << ' ' << st << endl;
	// if(st < 0) cout << l << ' ' << mod << ' ' << __gcd(l,mod) << endl;
	ma = max(ma,st);
	mi = min(mi,st);
}
int main(){
	cin >> n >> k;
	ll a,b;
	cin >> a >> b;
	ll s = 1 + a;
	mod = n*k;
	ll e;
	for(ll i=1;i<=n*k;i+=k){
		// cout << i << endl;
		e = (i + b)%mod;
		cal(e,s);
		e = (i - b + n*k)%mod;
		cal(e,s);
	}
	cout << mi << ' ' << ma << endl;
	return 0;
}

#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <chrono>
#define FOR(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %ld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

const int MAXN = 100100;

int n, k, a, b;
ll m;

ll lcm (ll a_, ll b_) {
	ll c = __gcd (a_, b_);
	return a_ * b_ / c;
}

void load() {
	scanf("%d%d%d%d", &n, &k, &a, &b);
}

ll cyc (ll x) {
	while ( x < 0 ) x += m;
	return x % m;
}

vector<ll> ss;

ll x, y;

void solve1(ll s) {
	for (ll kand : ss) {
		ll cyc_ = cyc (kand - s);
		if (cyc_ == 0) cyc_ = m;
		//printf("cyc: %lld\n", cyc_);
		ll kor = lcm (cyc_, m);
		//printf("%lld %lld %lld\n", s, kand, kor);
		kor /= cyc_;
		x = min (x, kor);
		y = max (y, kor);
	}
}

void solve() {
	y = 0, x = 1e18;
	m = (ll) n * k;
	for (ll i = 0; i < m; i += k) {
		ll pret = cyc (i - b), nex = cyc (i + b);
		ss.push_back (pret);
		ss.push_back (nex);
	}
	ll pret = cyc (0 - a), nex = cyc (0 + a);
	solve1 (pret); solve1 (nex);
	printf("%lld %lld\n", x, y);
}

int main() {
	load();
	solve();
	return 0;
}

#include<bits/stdc++.h>
#include<cmath>
using namespace std;

#define ll long long
#define endl "\n"

ll n,k,a,b;

ll get(ll hm){
    ll L=(n*k)/__gcd(n*k,hm);
    return L;
}

int main(){
    ios_base::sync_with_stdio(false);

    cin>>n>>k>>a>>b;

    ll mn=1e9,mx=0;

    for(ll r=0;r<=n;r++){
        ll hm=r*k;
        mn=min(mn,get(abs(hm-a-b))), mx=max(mx,get(abs(hm-a-b)));
        mn=min(mn,get(abs(hm+a+b))), mx=max(mx,get(abs(hm+a+b)));
        mn=min(mn,get(abs(hm-a+b))), mx=max(mx,get(abs(hm-a+b)));
        mn=min(mn,get(abs(hm-b+a))), mx=max(mx,get(abs(hm-b+a)));
    }

    cout<<mn<<" "<<mx<<endl;
    return 0;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("sse4")

#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <queue>
#include <ctime>

using namespace std;

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define SZ(a) (int)(a).size()
#define ALL(a) (a).begin(), (a).end()

int k, b;
long long mn = (long long)1e18;
long long mx = -1;

void check(long long pos, long long iter) {
    if (pos < 0) pos += k;
    pos %= k;
    if (pos == b || pos == k - b) {
        mn = min(mn, iter);
        mx = max(mx, iter);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, a;
    cin >> n >> k >> a >> b;
    long long len = 1LL * n * k;
    vector<long long> div;
    for (long long i = 1; i * i <= len; i++) {
        if (len % i == 0) {
            div.push_back(i);
        }
    }
    for (long long mult = 1; mult <= 100100; mult++) {
        REP(i, SZ(div)) {
            long long d1 = div[i];
            long long d2 = mult * len / d1;
            check(a + d1, d2);
            check(-a + d1, d2);
            check(a + d2, d1);
            check(-a + d2, d1);
        }
        if (mx != -1) break;
    }
    if (mx == -1) {
        mn = mx = len * k;
    }
    cout << mn << " " << mx << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
#define ff first
#define ss second

int main() {
	ll n, k;
	cin>>n>>k;
	ll x, y;
	cin>>x>>y;
	ll mn = n*k+1;
	ll mx = -1;
	if (y!=x) {
		ll a = n*k/abs(y-x);
		mn = min(mn, a);
		mx = max(mx, a);
		a = n*k/(abs(k-y-x));
		mn = min(mn, a);
		mx = max(mx, a);
		// a = n*k/(abs(k+y-x));
		// mn = min(mn, a);
		// mx = max(mx, a);
	} else {
		ll a;
		mn = 1;
		a = n*k/(abs(k+y-x));
		mn = min(mn, a);
		mx = max(mx, a);
		if (y*2<k) {
			a = n*k/(abs(k-y-x));
			mn = min(mn, a);
			mx = max(mx, a);
		}
	}
	cout << mn << " " << mx << endl;

}

#include<iostream>
#include <vector>
#include<map>
using namespace std;
int n, k, a, b, minstop = 2147483647, maxstop;
int gcd(int a, int b){
	if(a < b)swap(a, b);
	while(a % b != 0){
		a %= b;
		swap(a, b);
	}
	return b;
}
int getstop(int l){
	if(l < 0)l += n * k;
	// cout << "getstop " << l << ' ';
	if(l == n * k || l == 0)return 1;
	return n * k / gcd(l, n * k);
}
int locof(int i){
	return i * k + 1;
}
void update(int cost){
	minstop = min(minstop, cost);
	maxstop = max(maxstop, cost);
}
int main(){
	cin >> n >> k >> a >> b;
	int s = 1 + a;
	for(int i = 1;i <= k;++i){
            // cout << "loc " << s << ' ' << locof(i) - b << '\n';
		int cost = getstop(locof(i) - b - s);
		cout << cost <<'\n';
		update(cost);
	}
	for(int i = 0;i < k;++i){
		// cout << "loc " << s << ' ' << locof(i) + b << '\n';
		int cost = getstop(locof(i) + b - s);
    cout << cost << '\n';
		update(cost);
	}
	s = locof(1) - a;
	for(int i = 1;i <= k;++i){
		// cout << "loc " << s << ' ' << locof(i) - b << '\n';
		int cost = getstop(locof(i) - b - s);
		cout << cost << '\n';
		update(cost);
	}
	for(int i = 0;i < k;++i){
		// cout << "loc " << s << ' ' << locof(i) + b << '\n';
		int cost = getstop(locof(i) + b - s);
		cout << cost <<'\n';
		update(cost);
	}
	// for(int j = 1;j <= k;++j){
 //            cout << j * k - b - a << '\n';
	// 	if(j * k - b - a == 0 || j * k - b - a == n * k)continue;
	// 	int stop = getstop(j * k - b - a);
	// 	cout << "JJ "<<j * k - b - a << '\n';
	// 	minstop = min(stop, minstop);
	// 	maxstop = max(stop, maxstop);
	// }
	// for(int j = 0;j < k;++j){
	// 	if(j * k + b - a == 0)continue;
	// 	int stop = getstop(j * k + b - a);
	// 	minstop = min(minstop, stop);
	// 	maxstop = max(maxstop, stop);
	// }
	// for(int j = 1;j <= k;++j){
	// 	if(j * k + 1 - b - (k + 1 - a) == 0 || j * k + 1 - b - (k + 1 - a) == n * k)continue;
	// 	int stop = getstop(j * k + 1 - b -(k + 1 - a));
	// 	minstop = min(stop, minstop);
	// 	maxstop = max(stop, maxstop);
	// }
	// for(int j = 0;j < k;++j){
	// 	if(j * k + 1 + b - (k + 1 - a) == 0)continue;
	// 	int stop = getstop(j * k + 1 + b - (k + 1 - a));
	// 	minstop = min(minstop, stop);
	// 	maxstop = max(maxstop, stop);
	// }
	cout << minstop << ' ' << maxstop;
}

#include<bits/stdc++.h>//������ò�����ʽ
#define endl "\n"
using namespace std;
typedef pair<int, int> P;

int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a%b);
}
int main(){
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
    int n, k, a, b;
    cin>>n>>k>>a>>b;
    int c1 = (a+b)%k;//�󲽾���
    int c2 = (a-b)%k;
    int c3 = (b-a)%k;
    int c4 = (-a-b)%k;
    queue<P> que;
    for(int i = 0; i <= n; i++){
        que.push(P(i, c1));
        que.push(P(i, c2));
        que.push(P(i, c3));
        que.push(P(i, c4));
        //cout<<i<<' '<<c1<<' '<<i<<' '<<c2<<endl;
    }

    int maxn = 0, mini = 9999999;
    //cout<<maxn<<mini<<endl;

    while(!que.empty()){
        P p1 = que.front();que.pop();
        //cout<<p1.first<<' '<<p1.second<<endl;
        int l = abs(k*p1.first + p1.second);
        int num = k*n/gcd(n*k,l);
        maxn = max(num, maxn);//��ѭ���������ܳ��ȴ������Լ��
        mini = min(num, mini);
    }
    cout<<mini<<' '<<maxn;

    return 0;
}

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ff              first
#define ss              second
#define pb(x)           push_back(x)
#define mp              make_pair
#define sz(x)           (int)x.size()
#define mem(x ,y)       memset(x , y , sizeof x )
#define all(a )         a.begin() , a.end()
#define endl            "\n"
#define pii             pair<int,int>
#define piii            pair<int,pair<int,int > >
#define clr(x)          x.clear()
#define sl(x )          scanf("%I64d" ,&x)
#define sll(x,y )       scanf("%I64d%I64d" ,&x ,&y)
#define si(x )          scanf("%d" ,&x)
#define forn(i,x,y )    for(int i= x; i<=y ; i++ )
#define ford(i,x,y )    for(int i= x; i>=y ; i-- )
#define rep(i,n )       for(int i= 0; i<n ; i++ )
#define repi(i,n )      for(int i= 1; i<=n ; i++ )
#define repit(i, c)     for( __typeof((c).begin()) i = (c).begin(); i != (c).end();++i )

#ifndef ONLINE_JUDGE
    #define dbg(args...)    do {   cout << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
#else
    #define dbg(args...)   ;
#endif

typedef long long ll  ;
typedef unsigned long long ull  ;

#define  int  ll
ll  mod =  1e9+7, mod2 =     998244353;
int setbit(int n, int pos  ) { return n = n|(1LL<< pos) ; }
int resetbit(int n,int pos ) { return n = n & ~(1LL<<pos ); }
bool checkbit(int n,int pos) { return (bool ) (n&(1LL<<pos))  ; }
template<typename T> void print(const T& v) {    cerr << v << ' ' ;}
template<typename T>T add(T x, T y, T mod = mod ){ x%= mod ;  y%= mod ;   return (x+y)%mod ;  }
template<typename T>T sub(T x, T y, T mod = mod ){ return ((x-y)%mod+mod )%mod;  }
template<typename T>T mul(T x, T y, T mod = mod ){ x %= mod ; y %= mod ; return (x*y)%mod  ;  }
template<typename T1,typename... T2> void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}
template<typename T> void dbg_a(T a[] ,int n=10 ) {cerr << "[ "; for(int i=0;i <= n ; i++ )cerr<<a[i]<<' ' ; cerr<< " ]" <<  endl; }
template<typename F,typename S>ostream& operator<<( ostream& os, const pair< F, S > & p ){return os << "[ " << p.first << ", " << p.second << " ]";}
template<typename T>ostream &operator<<(ostream & os, const vector< T > &v ){os << "[ "; for(int i=0; i<sz(v) ; i++ )  os << v[i] << ' ' ; return os << " ]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const map< T ,T> &Map ){os << "[ "; repit(it , Map ) os << "[" <<(*it).ff << ' ' << (*it).ss << "] "    ; return os << "]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const set< T > &Set  ){os << "[ "; repit(it , Set ) os <<  *it  << ' ' ; return os << " ]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const multiset< T > &Set) {os << "[ "; repit(it , Set )os <<  *it  << ' ' ; return os << " ]\n" ; }
template<class T> string to_str(T t){stringstream ss; ss<<t; return ss.str();}
// typedef tree<   int ,     // change type
//               null_type,
//               less_equal  < int  >  ,  // change type ..
//               rb_tree_tag,
//               tree_order_statistics_node_update> ordered_set;

    // order_of_key (k) : Number of items strictly smaller than k .
    // find_by_order(k) : K-th element in a set (counting from zero).
template < typename T >
T powmod(T a,T b  ,T mod = mod ) {
    if( !b ) return 1;
    if( b%2 ) return powmod(a,b-1)*a%mod;
    T c =  powmod(a,b/2);
    return c*c%mod;
}

template < typename T >
T  invmod( T x , T m = mod) {
    return powmod(x,m-2 , m) ;
}

const int maxn  = (int)1e6+123 ;
const ll inf  =  1e18; //0xc0  ;//0x3f ;
////////////////////////////////////////////

int n,m,sum   , len ;
int a[maxn ]  , cnt1[40]  ,cnt2[40];

int  ask_or(int i,int  j) {
    cout <<"OR " <<  i  << ' ' << j <<  endl ;
    int  x  ; cin >> x  ; return x ;
}
int  ask_xor(int i,int  j) {
    cout <<"XOR " <<  i  << ' ' << j <<  endl ;
    int  x  ; cin >> x  ; return x ;
}

void  solve(){
    int x,y,z,k,q,ans = 0, tot=0  ,cnt = 0 ,d   ;
    int  aa , bb ,nn  ;

    cin >> n >> k >>aa >> bb    ;
    nn = n*k  ;

    vector<int > divs  ;
    //get divs

    for(int i=1 ;i*i<=nn  ;  i++ ) if(nn%i==0)  {
        x = i ;
        if( (aa+x)%k==bb or (k-(aa+x)%k )%k == bb  ) {
            divs.pb(x)  ;
        }

        x  = nn/i ;
        if(x==i) continue ;
        if( (aa+x)%k== bb or (k-(aa+x)%k )%k == bb ) {
            divs.pb(x)  ;
        }
    }
    aa = ((-aa+k )%k+k)%k ;
    for(int i=1 ;i*i<=nn  ;  i++ ) if(nn%i==0)  {
        x = i ;
        if( (aa+x)%k==bb or (k-(aa+x)%k )%k == bb  ) {
            divs.pb(x)  ;
        }

        x  = nn/i ;
        if(x==i) continue ;
        if( (aa+x)%k== bb or (k-(aa+x)%k )%k == bb ) {
            divs.pb(x)  ;
        }
    }

    sort(all(divs) )  ;

    cout << nn/divs.back()<<' ' << nn/divs[0] << endl ;

}
signed main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
    #endif
    ios :: sync_with_stdio(false);  cin.tie(0);  cout.tie(0) ;
    // cout << fixed << setprecision( 12) ;
    int t = 1 , cs =0   ;
    // cin >> t ;
    while(t--)   {
        solve()  ;
    }
    return 0 ;
}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define readFile freopen("in.txt", "r", stdin)
#define printFile freopen("out.txt", "w", stdout)

vector <ll> v;

// CHECK LONG LONG

int main() {
    ios_base::sync_with_stdio(false);

    ll n, k, a, b, total;
    cin>>n>>k;
    cin>>a>>b;

    total = n * k;

    if(a==b) v.push_back(1);
    if(n>1) {
        ll first = 1, second = 1 + k;
        ll t1 = first - a + total, t2 = first + b;
        ll t3 = a + b;
        if(t3!=0 && total%t3==0) v.push_back(total/t3);

        t1 = first - a + total, t2 = first - b + total;
        t3 = t2 - t1;
        if(t3!=0 && t1<=t2 && total%t3==0) v.push_back(total/t3);

        t1 = first - a + total, t2 = second - b;
        t3 = a + (t2 - 1);
        if(t3!=0 && total%t3==0) v.push_back(total/t3);

        t1 = first - a + total, t2 = second + b;
        t3 = a + (second - 1) + b;
        if(t3!=0 && total%t3==0) v.push_back(total/t3);

        t1 = first + a, t2 = first + b;
        t3 = t2 - t1;
        if(t3!=0 && t1<=t2 && total%t3==0) v.push_back(total/t3);

        t1 = first + a, t2 = first - b + total;
        t3 = t2 - t1;
        if(t3!=0 && t1<=t2 && total%t3==0) v.push_back(total/t3);

        t1 = first + a, t2 = second - b;
        t3 = t2 - t1;
        if(t3!=0 && t1<=t2 && total%t3==0) v.push_back(total/t3);

        t1 = first + a, t2 = second + b;
        t3 = t2 - t1;
        if(t3!=0 && t1<=t2 && total%t3==0) v.push_back(total/t3);

    }
    else {
        ll first = 1, second = 1 + k;
        ll t1 = first - a + total, t2 = first + b;
        ll t3 = (t2 - 1) + a;
        if(t3!=0 && total%t3==0) v.push_back(total/t3);

        t1 = first - a + total, t2 = first - b + total;
        t3 = t2 - t1;
        if(t3!=0 && t2>=t1 &&  total%t3==0) v.push_back(total/t3);

        t1 = first + a, t2 = first + b;
        t3 = t2 - t1;
        if(t3!=0 && t2>=t1 && total%t3==0) v.push_back(total/t3);

        t1 = first + a, t2 = first - b + total;
        t3 = (t1 - 1) + b;
        if(t3!=0 && total%t3==0) v.push_back(total/t3);
    }

    sort(v.begin(), v.end());

    cout<<v[0]<<" "<<v[v.size()-1]<<endl;
    return 0;
}

//30, 03, 2019, 14:32:06 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

vector< ll > p1, p2;
ll nn;

ll solve(ll tmp){
    return nn / __gcd(tmp, nn);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, k;
    ll a, b;

    cin >> n >> k;
    cin >> a >> b;

    if(n == k && n == 1){
        cout << 1 << " " << 1 << endl;
        return 0;
    }

    if(k % 2LL != 0LL || a != k / 2LL){
        p1.push_back(a + 1LL);
    }

    p1.push_back(k - a + 1LL);

    if(k % 2 != 0LL || b != k / 2LL){
        p2.push_back(b + 1LL);
    }

    p2.push_back(k - b + 1LL);

    nn = n * k;

    ll best_mn = ll(1e18), best_max = -1LL;

    for(int i = 0 ; i < 2 ; i++){
        // cout << "p[i] = " << p1[i] << endl;
        for(int j = 0 ; j < 2 ; j++){
            // cout << "p[j] = " << p2[j] << endl;
            ll diff = p2[j] - p1[i];

            for(ll p = 0 ; p <= n + 10LL ; p++){
                ll tmp = diff + p * k;

                if(tmp < 0LL){
                    continue;
                }
                // cout << tmp << endl;

                best_mn = min(best_mn, solve(tmp));
                best_max = max(best_max, solve(tmp));
            }

            diff *= -1LL;

            for(ll p = 0 ; p <= n + 10LL ; p++){
                ll tmp = diff + p * k;

                if(tmp < 0LL){
                    continue;
                }
                // cout << tmp << endl;

                best_mn = min(best_mn, solve(tmp));
                best_max = max(best_max, solve(tmp));
            }
        }
    }

    cout << best_mn << " " << best_max << endl;

    return 0;
}

#include <cstdio>
#include <iostream>
#define ll long long
using std::min;
using std::max;

ll gcd(ll a, ll b){
	if(a == 0 || b == 0)/*边界问题，随便处理下 (*/
		return 1;
	while(b ^=a ^=b ^=a %=b) ;
	return a;
}

int main(){
	ll n, k, a, b;
	scanf("%lld%lld%lld%lld", &n, &k, &a, &b);
	ll mn =0x7f7f7f7f7f7f7f7f, mx =-0x7f7f7f7f7f7f7f7f;
	ll start_l[4];
	/*( 下面 "|" 指快餐店，"s0", "s1", 分别指停 0 次，停 1 次，"<-"/"->" 指 a 或 b )*/
	start_l[0] =a+b, start_l[1] =(k-b)-a;/*|-s0->|<-s1-|, |<-s0-s1->|*/
	start_l[2] =(-a)+b, start_l[3] =a+(-b);/*|<-s0-|<-s1-|, |-s0->|-s1->|*/
	for(int i =0; i < 4; ++i)
		for(ll l =start_l[i]; l <= n*k; l +=k){/*因为每次加 k，l 超过 n*k 后取值一定循环*/
			if(l <= 0)
				continue;
			/*xl = ynk*/
			ll Lcm =l/gcd(l, n*k)*n*k;
			ll x =Lcm/l;/*这里盲猜的结论*/
			mn =min(mn, x);
			mx =max(mx, x);
		}
	printf("%lld %lld", mn, mx);
}

#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define fd(i,a,b)for(int i=b,_e=a;i>=_e;--i)
#define ll long long
#define db double
using namespace std;
const int N=2e5+5;
ll n,k,a,b;
ll ans,mi,ma,o;
void R(ll &n){
	char c;for(n=0;(c=getchar())<48;);
	for(;c>47;c=getchar())n=n*10+c-48;
}
int gcd(ll a,ll b){
	for(;b;b%=a)swap(a,b);
	return a;
}
void calc(ll b,ll a){
	b-=a;
	fo(i,0,n){
		if(b>0){
			o=(ll)n*k/gcd((ll)n*k,b);
			mi=min(mi,o);
			ma=max(ma,o);
		}
		b+=k;
	}
}
int main(){
	R(n);R(k);
	R(a);R(b);
	mi=1e18;ma=0;
	calc(b,a);
	calc((k-b)%k,a);
	calc((k-b)%k,(k-a)%k);
	calc(b,(k-a)%k);
	printf("%I64d %I64d",mi,ma);
}