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

long long n, k, x, y;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    freopen("file.inp", "r", stdin);
    freopen("file.out", "w", stdout);

    cin >> n >> k >> x >> y;

     long long cnt_scp = sqrt(n);

    long long ans_1 = x;

    for (long long j = 1; j <= 3 * k; j++)
    {
        if(j % 3 == 1)
        {
            long long x_root = sqrt(ans_1);

            if(x_root * x_root == ans_1)
            {
                ans_1 = x_root;
            }
            else
            {
                ans_1 = ans_1 + (cnt_scp - x_root);
            }
        }
        else if(j % 3 == 2)
        {
            long long x_root = sqrt(ans_1);

            if(x_root * x_root == ans_1)
            {
                ans_1 = x_root + n - cnt_scp;
            }
            else
            {
                ans_1 -= x_root;
            }
        }
        else
        {
            ans_1 = n - ans_1 + 1;
        }
    }

    long long ans_2 = y;

    for (long long i = 3 * k; i >= 1; i--)
    {
        if(i % 3 == 0)
        {
            ans_2 = n - ans_2 + 1;
        }
        else if(i % 3 == 2)
        {
            if(ans_2 > n - cnt_scp)
            {
                long long x_root = ans_2 + cnt_scp - n;
                ans_2 = x_root * x_root;
            }
            else
            {
                long long r = round(sqrt(ans_2));
                ans_2 = ans_2 + r;
            }
        }
        else
        {
            if(ans_2 <= cnt_scp)
            {
                ans_2 = ans_2 * ans_2;
            }
            else
            {
                long long b = ans_2 - cnt_scp;
                long long r = round(sqrt(b));
                ans_2 = b + r;
            }
        }
    }

    cout << ans_1 << " " << ans_2;
}
