On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others.Seating in the class looks like a rectangle, where n rows with m pupils in each. The teacher asks pupils in the following order: at first, she asks all pupils from the first row in the order of their seating, then she continues to ask pupils from the next row. If the teacher asked the last row, then the direction of the poll changes, it means that she asks the previous row. The order of asking the rows looks as follows: the 1-st row, the 2-nd row, ..., the n - 1-st row, the n-th row, the n - 1-st row, ..., the 2-nd row, the 1-st row, the 2-nd row, ...The order of asking of pupils on the same row is always the same: the 1-st pupil, the 2-nd pupil, ..., the m-th pupil.During the lesson the teacher managed to ask exactly k questions from pupils in order described above. Sergei seats on the x-th row, on the y-th place in the row. Sergei decided to prove to the teacher that pupils are asked irregularly, help him count three values:  the maximum number of questions a particular pupil is asked,  the minimum number of questions a particular pupil is asked,  how many times the teacher asked Sergei. If there is only one row in the class, then the teacher always asks children from this row.

The first and the only line contains five integers n, m, k, x and y (1 ≤ n, m ≤ 100, 1 ≤ k ≤ 1018, 1 ≤ x ≤ n, 1 ≤ y ≤ m).

Print three integers:   the maximum number of questions a particular pupil is asked,  the minimum number of questions a particular pupil is asked,  how many times the teacher asked Sergei.

NoteThe order of asking pupils in the first test:   the pupil from the first row who seats at the first table, it means it is Sergei;  the pupil from the first row who seats at the second table;  the pupil from the first row who seats at the third table;  the pupil from the first row who seats at the first table, it means it is Sergei;  the pupil from the first row who seats at the second table;  the pupil from the first row who seats at the third table;  the pupil from the first row who seats at the first table, it means it is Sergei;  the pupil from the first row who seats at the second table; The order of asking pupils in the second test:   the pupil from the first row who seats at the first table;  the pupil from the first row who seats at the second table;  the pupil from the second row who seats at the first table;  the pupil from the second row who seats at the second table;  the pupil from the third row who seats at the first table;  the pupil from the third row who seats at the second table;  the pupil from the fourth row who seats at the first table;  the pupil from the fourth row who seats at the second table, it means it is Sergei;  the pupil from the third row who seats at the first table;

#include<stdio.h>
int turn(int x)
{
    if(x==1) return 2;
    else return 1;
}
int main()
{
    int m,n,x,y,flag=0;
    long long int k,row,rec,ans[102]={0},other[102]={0};
    long long int maxv=0,minv,ser;
    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    row=k/m;rec=k%m;
    if(n>2)
    {
        if(row>0)
        {
            long long int note=(row-1)/(n-1);
            int left=(row-1)%(n-1);
            ans[1]=note/2+1;
            if(note>0)  ans[n]=(note-1)/2+1;
            for(int i=2;i<n;i++)
                ans[i]=note;
            if(note%2==0)
            {
                if(rec)
                    flag=2+left;
                other[flag]=1;
                for(int i=1;i<=left;i++)
                    ans[i+1]++;
            }
            else
            {
                if(rec)
                    flag=n-1-left;
                other[flag]=1;
                for(int i=1;i<=left;i++)
                    ans[n-i]++;
            }
            for(int i=1;i<=n;i++)
            {
                long long int tem=ans[i]+other[i];
                if(tem>maxv) maxv=tem;
            }
            minv=maxv;
            for(int i=1;i<=n;i++)
                if(ans[i]<minv) minv=ans[i];
            ser=ans[x];
            if(x==flag && y<=k%m) ser++;
        }
        else
        {
            maxv=minv=row;
            if(rec)
                maxv=minv+1;
            if(y<=rec && x==1)
                ser=maxv;
            else
                ser=minv;
        }
    }
    else if(n==1)
    {
        maxv=minv=row;
        if(rec)
            maxv=minv+1;
        if(y<=rec)
            ser=maxv;
        else ser=minv;
    }
    else if(n==2)
    {
        long long int note[3][2]={0};
        int tem=turn(row%2);
        note[1][0]=note[2][0]=row/2;
        if(row%2) note[1][0]++;
        if(rec)
            note[tem][1]=1;
        for(int i=1;i<3;i++)
            if(note[i][0]+note[i][1]>maxv)
                maxv=note[i][0]+note[i][1];
        minv=maxv;
        for(int i=1;i<3;i++)
            if(note[i][0]<minv)
                minv=note[i][0];
        ser=note[x][0];
        if(tem==x && y<=rec) ser++;
    }
    printf("%lld %lld %lld",maxv,minv,ser);
    return 0;
}

#include<stdio.h>
int main()
{
    int n,m,x,y;
    long long int k,p,min,max,cur,g;
    scanf("%d %d %I64d %d %d",&n,&m,&k,&x,&y);
    if(n==1)
    {
       p=k/m;
       g=k%(long long)m;
       min=p;
       if(g>0)
        max=p+1;
       else
        max=p;
       if(g>=y)
        cur=p+1;
       else
        cur=p;
    }
    else if(n==2)
    {
        p=k/((long long)m);
        g=k%((long long)m);
        if(p%2==0)
        {
            if(g>0)
            max=p/2+1;
            else
            max=p/2;
            min=p/2;
            if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==2)
           {
                cur=p/2;
           }
        }
        else
        {
            max=p/2+1;
            min=p/2;
            if(x==1)
           {
                cur=p/2+1;
           }
           else if(x==2)
           {
                if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
        }
    }
    else
    {
        p=k/((long long)((n-1)*m));
        g=k%((long long)((n-1)*m));
        if(p==0)
        {
            max=1;
            min=0;
            if(g>=(x-1)*m+y)
            cur=1;
            else
            cur=0;
        }
       else if(p%2==0)
       {
           if(g>m)
            max=p+1;
           else
            max=p;
           min=p/2;
           if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==n)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(x-1)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
       else
       {
          if(g>=m)
            min=p/2+1;
          else
            min=p/2;
          if(g>m)
            max=p+1;
          else
           max=p;
          if(x==1)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+2;
               else
                cur=p/2+1;
           }
           else if(x==n)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(n-x)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
    }
    printf("%I64d %I64d %I64d",max,min,cur);
}

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

int main() {
	//code
	int n,m,x1,y1;
	long long int k;
	scanf("%d %d %lld %d %d",&n,&m,&k,&x1,&y1);
	int t;
	if(n==1){
	    t=m;
	}
	else{
	t=n*m+(n-2)*m;
	}

	long long int x=k/t;
	//cout<<q<<endl;
	long long int weight[n][m];
	int i,j;
	for(i=0;i<n;i++){
	    for(j=0;j<m;j++){
	        if(i==0 || i==(n-1)){
	            weight[i][j]=x;

	        }
	        else{
	            weight[i][j]=2*x;
	        }
	    }
	}
	int y=k%t;
	int flag=0;
	for(i=0;i<n;i++){
	    if(flag==1){
	        break;
	    }
	    for(j=0;j<m;j++){
	        if(y==0){
	            flag=1;
	            break;
	        }
	        weight[i][j]++;
	        y--;
	    }
	}
	//cout<<y<<endl;
	flag=0;
	for(i=n-2;i>0;i--){
	    if(flag==1){
	        break;
	    }
	    for(j=0;j<m;j++){
	        if(y==0){
	            flag=1;
	            break;

	        }
	        weight[i][j]++;
	        //cout<<weight[i][j]<<endl;
	        y--;
	    }
	}

	long long int min=weight[0][0];
	long long int max=weight[0][0];
	for(i=0;i<n;i++){
	    for(j=0;j<m;j++){
	        if(weight[i][j]<min){
	            min=weight[i][j];
	        }
	        if(weight[i][j]>max){
	            max=weight[i][j];
	        }
	    }
	}
	printf("%lld %lld %lld",max,min,weight[x1-1][y1-1]);

	return 0;
}

#include <stdint.h>
#include <stdio.h>

int main() {
    uint16_t n, m, x, y;
    uint64_t k;
    scanf("%hu %hu %I64u %hu %hu", &n, &m, &k, &x, &y);
    uint64_t t, seryo, mini, maxi;
    if (n == 1) {
        t = k / m;
        mini = t;
        k -= t * m;
        maxi = t + (k > 0);
        seryo = t + (k >= y);
        goto END;
    }
    if (n == 2) {
        t = k / (2 * m);
        mini = t;
        k -= t * 2 * m;
        maxi = t + (k > 0);
        seryo = t + (k >= (x - 1) * m + y);
        goto END;
    }
    t = k / ((n - 1) * m);
    k -= t * (n - 1) * m;
    uint64_t mid_row = t;
    uint64_t first_row = (t + 1) / 2;
    uint64_t last_row = t / 2;
    mini = last_row;
    maxi = (t == 0) ? (k > 0) : mid_row + (k > m);
    if (x == 1)
        seryo = first_row;
    else if (x == n)
        seryo = last_row;
    else
        seryo = mid_row;
    if (t % 2 == 0) /* then we start counting from first row */
        seryo += (k >= (x - 1) * m + y);
    else {
        mini += (k >= m);
        seryo += (k >= (n - x) * m + y);
    }
END:
    printf("%I64u %I64u %I64u\n", maxi, mini, seryo);
    return 0;
}

#include<stdio.h>
long long k,round,min,max,val,tmp;
int n,m,x,y,rem,tmpx,tmpy;//xΪ������yΪ����
int a[110][110];
int main(){
	scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
	if(n>1){
		round=k/(m*(2*n-2));
	    rem=k%(m*(2*n-2));
	    int dir=1;
	    tmpx=1;tmpy=1;
	    while(rem>0){
	    	a[tmpx][tmpy]++;
	    	rem--;
	    	if(tmpy<m)tmpy++;
	    	else {
			    if(tmpx+dir>n||tmpx+dir<1)dir=-dir;
			    tmpx=tmpx+dir;
			    tmpy=1;
			}
		}
		int i,j;

		max=0;min=k;
		for(i=1;i<=n;i++)
		 for(j=1;j<=m;j++){
		 	 if(i==1||i==n)tmp=round+a[i][j];
		 	 else tmp=round*2+a[i][j];
		 	 if(tmp>max)max=tmp;
		 	 if(tmp<min)min=tmp;
		 	 if(i==x&&j==y)val=tmp;
		 }
	}
	else{
		round=k/m;
		rem=k%m;
		if(rem>0){
			max=round+1;
			min=round;
			if(rem>=y)val=round+1;
			else val=round;
		}
		else{
			max=round;
			min=round;
			val=round;
		}
	}
	printf("%lld %lld %lld",max,min,val);
	return 0;
}

//今天晚上没有BUG！！！
//今天晚上没有BUG！！！
//今天晚上没有BUG！！！
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
long long a[105][105];
int main()
{
    int n,m,x,y;
    long long k;
    scanf("%d %d %lld %d %d",&n,&m,&k,&x,&y);
    long long shang,yushu;
    int numb1=(n-1)*m;
    if (n==1)
    {
        shang=k/(n*m);
        yushu=k%(n*m);
        int mm,jj;
        for (mm=1;mm<=m;mm++)
            a[1][mm]=shang;
        for (mm=1;mm<=yushu;mm++)
            a[1][mm]++;
        long long maxx=0,minn=1000000000000000000;
        for (jj=1;jj<=m;jj++)
        {
            maxx=maxx>a[1][jj]? maxx:a[1][jj];
            minn=minn<a[1][jj]? minn:a[1][jj];
        }
        printf("%lld %lld %lld",maxx,minn,a[x][y]);
        return 0;
    }
    shang=k/numb1;
    yushu=k%numb1;
    int i,j;
        for (i=1;i<=n;i++)
        {
            for (j=1;j<=m;j++)
                a[i][j]=shang/2;
        }
        for (i=2;i<n;i++)
        {
            for (j=1;j<=m;j++)
                a[i][j]+=shang/2;
        }
    if (shang%2)
    {
        for (i=1;i<n;i++)
        {
            for (j=1;j<=m;j++)
                a[i][j]++;
        }
    }
    i=1;
    while (yushu>0&&(shang%2==0))//先后顺序
    {
        for (j=1;j<=m;j++)
        {
            if (yushu>0)
            {
                a[i][j]++;
                yushu--;
            }
        }
        i++;
    }
    i=n;
    while (yushu>0&&(shang%2!=0))//先后顺序
    {
        for (j=1;j<=m;j++)
        {
            if (yushu>0)
            {
                a[i][j]++;
                yushu--;
            }
        }
        i--;
    }
    long long maxx=0,minn=1000000000000000000;
    for (i=1;i<=n;i++)
    {
        for (j=1;j<=m;j++)
        {
            maxx=maxx>a[i][j]? maxx:a[i][j];
            minn=minn<a[i][j]? minn:a[i][j];
        }
    }
    printf("%lld %lld %lld",maxx,minn,a[x][y]);
    return 0;
}

#include <stdio.h>

#define INF 100000000000000000L

typedef long long INT64;

int main(void) {
    INT64 i = 0, j = 0, n = 0, m = 0, k = 0;
    INT64 x = 0, y = 0, arr[101] = {0, }, cnt = 0;
    INT64 serg = 0, max = 0, min = -1;

    scanf("%lld %lld %lld %lld %lld", &n, &m, &k, &x, &y);
    INT64 q = k / m;
    INT64 r = k % m;
    if (n == 1) {
        if (y <= r) {
            serg = q + 1;
        } else {
            serg = q;
        }

        min = q;

        if (r == 0) {
            max = q;
        } else {
            max = q + 1;
        }
    } else {
        cnt = q / (2 * (n - 1));
        arr[1] = arr[n] = cnt;
        k -= (2 * (n - 1)) * cnt * m;
        for (i=2;i<=n-1;i++) {
            arr[i] = 2 * cnt;
        }

        for (i=1;i<=n;i++) {
            if (k < m) {
                break;
            }

            arr[i]++;
            k -= m;
        }

        if (i > n) {
            for (i=n-1;i>1;i--) {
                if (k < m) {
                    break;
                }

                arr[i]++;
                k -= m;
            }
        }

        if (k != 0) {
            arr[i]++;
        }

        min = INF;

        for (j=1;j<=n;j++) {
            if (arr[j] > max) {
                max = arr[j];
            }

            if (arr[j] <= min) {
                if (j == i) {
                    if (k == 0) {
                        min = arr[j];
                    } else {
                        min = arr[j] - 1;
                    }
                } else {
                    min = arr[j];
                }
            }
        }

        if (x != i) {
            serg = arr[x];
        } else {
            if (k == 0 || y <= k) {
                serg = arr[i];
            } else {
                serg = arr[i] - 1;
            }
        }
    }

    printf("%lld %lld %lld\n", max, min, serg);

    return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

long long int max(long long int a,long long int b)
{
    if(a>b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp,j;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=arr[1];

            if(remaining_questions<n*m)
            minimum--;

           maximum=0;

           for(i=1;i<n+1;i++)
           maximum=max(maximum,arr[i]);

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n*m > k)
    {
           max = 1;
           min = 0;
           if((x-1)*m+y <= k)S = 1;
           else S = 0;
    }
    else if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 j = k%(m*n);
                 if(j > m)
                 {
                            if(x == 2 && j-m < y)S = min;
                            else S = max;
                 }
                 else
                 {
                     if(x == 1 && j >= y)S = max;
                     else S = min;
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if((x-1)*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>

int n, m;

long long count(int x, int y, long long k) {
	long long z;

	if (n <= 2) {
		z = k / (n * m);
		k %= n * m;
		if ((x - 1) * m + y <= k)
			z++;
	} else {
		z = k / ((n + n - 2) * m);
		if (x > 1 && x < n)
			z *= 2;
		k %= (n + n - 2) * m;
		if ((x - 1) * m + y <= k)
			z++;
		if (x > 1 && x < n && (n - 1 - x) * m + y <= k - n * m)
			z++;
	}
	return z;
}

long long max2(long long a, long long b) {
	return a > b ? a : b;
}

long long min2(long long a, long long b) {
	return a < b ? a : b;
}

int main() {
	int x, y;
	long long k, max, min, ser;

	scanf("%d%d%lld%d%d", &n, &m, &k, &x, &y);
	max = n <= 2 ? count(1, 1, k) : max2(max2(count(1, 1, k), count(2, 1, k)), max2(count(n - 1, 1, k), count(n, 1, k)));
	min = n <= 2 ? count(n, m, k) : min2(min2(count(1, m, k), count(2, m, k)), min2(count(n - 1, m, k), count(n, m, k)));
	ser = count(x, y, k);
	printf("%lld %lld %lld\n", max, min, ser);
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define dll unsigned long long

#define SIZE 105

int n, m, x, y;
dll k, ans[SIZE][SIZE];

int main()
{
	int i, j;
	dll max = 0, min = 18446744073709551615, full_come, total_comes;

	scanf("%d %d %I64u %d %d", &n, &m, &k, &x, &y);

	full_come = n * m;
	if (n > 2)
		full_come += (n - 2) * m;

	total_comes = k / full_come;

	k %= full_come;

	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
		{
			ans[i][j] += total_comes;
			if (i > 0 && i < n - 1)
				ans[i][j] += total_comes;
		}

	for (i = 0; k > 0 && i < n; i++)
		for (j = 0; j < m && k > 0; j++)
		{
			ans[i][j]++;
			k--;
		}

	for (i = n - 2; k > 0 && i > 0; i--)
		for (j = 0; j < m && k > 0; j++)
		{
			ans[i][j]++;
			k--;
		}

	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
		{
			if (ans[i][j] > max)
				max = ans[i][j];
			if (ans[i][j] < min)
				min = ans[i][j];
		}

	printf("%I64u %I64u %I64u", max, min, ans[x - 1][y - 1]);

	return 0;
}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
	int n,m,x,y;
	long long int k;
	scanf("%d %d %I64d %d %d",&n,&m,&k,&x,&y);

	long long int max=0,min=k;
	long long int asked_cnt[n][m];
	int i,j;

	if(n==1){
		for(j=0;j<m;j++){
			asked_cnt[0][j]=k/m;
		}
		k=k%m;
		for(j=0;j<m&&k>0;j++){
			asked_cnt[0][j]++;
			k--;
		}
	}else{

	long long int fullAsked = k / (m*(2*n-2));

	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			if(i==0||i==n-1){
				asked_cnt[i][j]=fullAsked;
			}else{
				asked_cnt[i][j]=fullAsked*2;
			}
		}
	}

	k = k % (m*(2*n-2));

	for(i=0;i<n && k>0;i++){
		for(j=0;j<m && k>0;j++){
			asked_cnt[i][j]++;
			k--;
		}
	}

	for(i=n-2;i>0 && k>0 ;i--){
		for(j=0;j<m && k>0;j++){
			asked_cnt[i][j]++;
			k--;
		}
	}
	}

	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			if(asked_cnt[i][j]>max){
				max=asked_cnt[i][j];
			}
			if(asked_cnt[i][j]<min){
				min=asked_cnt[i][j];
			}
			//printf("%0d ",asked_cnt[i][j]);
		}
		//puts("");
	}

	printf("%I64d %I64d %I64d\n",max,min,asked_cnt[x-1][y-1]);

    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
    long long j,i,count,n,m,k,x,y,a[110]={0},ans,max,min;
    scanf("%lld%lld%lld%lld%lld",&n,&m,&k,&x,&y);
    if(n==1)
    {
        if(y<=k%m)
            ans=k/m+1;
        else
            ans=k/m;
        if(k%m!=0)
            printf("%lld %lld %lld\n",k/m+1,k/m,ans);
        else
            printf("%lld %lld %lld\n",k/m,k/m,k/m);
        return 0;
    }
    count=((k/m)/(2*n-2));
    a[1]=count;
    a[n]=count;
    k=k-(2*n-2)*count*m;
    for(i=2;i<=n-1;i++)
        a[i]=2*count;
    for(i=1;i<=n;i++)
    {
        if(k<m)
            break;
        a[i]++;
        k-=m;
    }
    if(i==n+1)
    {
        for(i=n-1;i>1;i--)
        {
            if(k<m)
                break;
            a[i]++;
            k-=m;
        }
    }
    j=i;
    min=1000000000000000000;
    max=0;
    if(k!=0)
        a[i]++;
    for(i=1;i<=n;i++)
    {
        if(a[i]>=max)
            max=a[i];
        if(a[i]<=min)
        {
            if(i==j)
            {
                if(k==0)
                  min=a[i];
                else
                    min=a[i]-1;
            }
            else
                min=a[i];
        }
    }
    if(x!=j)
        ans=a[x];
    else
    {
        if(k==0)
            ans=a[j];
        else if(y<=k)
            ans=a[j];
        else
            ans=a[j]-1;
    }
    printf("%lld %lld %lld\n",max,min,ans);
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <math.h>

int main()
{
    long long j,i,count,n,m,k,x,y,a[110]={0},ans,max,min;
    scanf("%lld%lld%lld%lld%lld",&n,&m,&k,&x,&y);
    if(n==1)
    {
        if(y<=k%m)
            ans=k/m+1;
        else
            ans=k/m;
        if(k%m!=0)
            printf("%lld %lld %lld\n",k/m+1,k/m,ans);
        else
            printf("%lld %lld %lld\n",k/m,k/m,k/m);
        return 0;
    }

    count=((k/m)/(2*n-2));
    a[1]=count;
    a[n]=count;
    k=k-(2*n-2)*count*m;
    for(i=2;i<=n-1;i++)
        a[i]=2*count;
    for(i=1;i<=n;i++)
    {
        if(k<m)
            break;
        a[i]++;
        k-=m;
    }
    if(i==n+1)
    {
        for(i=n-1;i>1;i--)
        {
            if(k<m)
                break;
            a[i]++;
            k-=m;
        }
    }
    j=i;
    min=1000000000000000000;
    max=0;
    if(k!=0)
        a[i]++;
    for(i=1;i<=n;i++)
    {
        if(a[i]>=max)
            max=a[i];
        if(a[i]<=min)
        {
            if(i==j)
            {
                if(k==0)
                  min=a[i];
                else
                    min=a[i]-1;
            }
            else
                min=a[i];
        }
    }
    if(x!=j)
        ans=a[x];
    else
    {
        if(k==0)
            ans=a[j];
        else if(y<=k)
            ans=a[j];
        else
            ans=a[j]-1;
    }
    printf("%lld %lld %lld\n",max,min,ans);
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define MAX 1000010
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)

long long len, n, m, k, x, y;
long long X[MAX], Y[MAX], counter[1010][1010];

int main(){
    long long i, j, v, min_v, max_v;

    while (scanf("%lld %lld %lld %lld %lld", &n, &m, &k, &x, &y) != EOF){
        len = 0;
        clr(counter);
        for (i = 1; i < n; i++){
            for (j = 1; j <= m; j++){
                X[len] = i, Y[len++] = j;
            }
        }
        for (i = n; i > 1; i--){
            for (j = 1; j <= m; j++){
                X[len] = i, Y[len++] = j;
            }
        }

        if (n == 1){
            for (i = 1; i <= m; i++) X[len] = 1, Y[len++] = i;
        }

        for (i = 0; i < len; i++) counter[X[i]][Y[i]] += (k / len);
        k %= len;
        for (i = 0; i < k; i++) counter[X[i]][Y[i]]++;

        min_v = max_v = counter[1][1];
        for (i = 1; i <= n; i++){
            for (j = 1; j <= m; j++){
                if (counter[i][j] < min_v) min_v = counter[i][j];
                if (counter[i][j] > max_v) max_v = counter[i][j];
            }
        }

        printf("%lld %lld %lld\n", max_v, min_v, counter[x][y]);
    }
    return 0;
}

#include<stdio.h>
int turn(int x)
{
    if(x==1) return 2;
    else return 1;
}
int main()
{
    int m,n,x,y,flag=0;
    long long int k,row,rec,ans[102]={0},other[102]={0};
    long long int maxv=0,minv,ser;
    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    row=k/m;rec=k%m;
    if(n>2)
    {
        long long int note=(row-1)/(n-1);
        int left=(row-1)%(n-1);
        if(note>0)  ans[1]=note/2+1;
        if(note>0)  ans[n]=(note-1)/2+1;
        for(int i=2;i<n;i++)
            ans[i]=note;
        if(note%2==0)
        {
            if(rec)
                flag=2+left;
            other[flag]=1;
            for(int i=1;i<=left;i++)
                ans[i+1]++;
        }
        else
        {
            if(rec)
                flag=n-1-left;
            other[flag]=1;
            for(int i=1;i<=left;i++)
                ans[n-i]++;
        }
        for(int i=1;i<=n;i++)
        {
            long long int tem=ans[i]+other[i];
            if(tem>maxv) maxv=tem;
        }
        minv=maxv;
        for(int i=1;i<=n;i++)
            if(ans[i]<minv) minv=ans[i];
        ser=ans[x];
        if(x==flag && y<=k%m) ser++;
    }
    else if(n==1)
    {
        maxv=minv=row;
        if(rec)
            maxv=minv+1;
        if(y<=rec)
            ser=maxv;
        else ser=minv;
    }
    else if(n==2)
    {
        long long int note[3][2]={0};
        int tem=turn(row%2);
        note[1][0]=note[2][0]=row/2;
        if(row%2) note[1][0]++;
        if(rec)
            note[tem][1]=1;
        for(int i=1;i<3;i++)
            if(note[i][0]+note[i][1]>maxv)
                maxv=note[i][0]+note[i][1];
        minv=maxv;
        for(int i=1;i<3;i++)
            if(note[i][0]<minv)
                minv=note[i][0];
        ser=note[x][0];
        if(tem==x && y<=rec) ser++;
    }
    printf("%lld %lld %lld",maxv,minv,ser);
    return 0;
}

#include<stdio.h>
int turn(int x)
{
    if(x==1) return 2;
    else return 1;
}
int main()
{
    int m,n,x,y,flag=0;
    long long int k,row,rec,ans[102]={0},other[102]={0};
    long long int maxv=0,minv,ser;
    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    row=k/m;rec=k%m;
    if(n>2)
    {
        if(row>0)
        {
            long long int note=(row-1)/(n-1);
            int left=(row-1)%(n-1);
            if(note>0)  ans[1]=note/2+1;
            if(note>0)  ans[n]=(note-1)/2+1;
            for(int i=2;i<n;i++)
                ans[i]=note;
            if(note%2==0)
            {
                if(rec)
                    flag=2+left;
                other[flag]=1;
                for(int i=1;i<=left;i++)
                    ans[i+1]++;
            }
            else
            {
                if(rec)
                    flag=n-1-left;
                other[flag]=1;
                for(int i=1;i<=left;i++)
                    ans[n-i]++;
            }
            for(int i=1;i<=n;i++)
            {
                long long int tem=ans[i]+other[i];
                if(tem>maxv) maxv=tem;
            }
            minv=maxv;
            for(int i=1;i<=n;i++)
                if(ans[i]<minv) minv=ans[i];
            ser=ans[x];
            if(x==flag && y<=k%m) ser++;
        }
        else
        {
            maxv=minv=row;
            if(rec)
                maxv=minv+1;
            if(y<=rec)
                ser=maxv;
            else ser=minv;
        }
    }
    else if(n==1)
    {
        maxv=minv=row;
        if(rec)
            maxv=minv+1;
        if(y<=rec)
            ser=maxv;
        else ser=minv;
    }
    else if(n==2)
    {
        long long int note[3][2]={0};
        int tem=turn(row%2);
        note[1][0]=note[2][0]=row/2;
        if(row%2) note[1][0]++;
        if(rec)
            note[tem][1]=1;
        for(int i=1;i<3;i++)
            if(note[i][0]+note[i][1]>maxv)
                maxv=note[i][0]+note[i][1];
        minv=maxv;
        for(int i=1;i<3;i++)
            if(note[i][0]<minv)
                minv=note[i][0];
        ser=note[x][0];
        if(tem==x && y<=rec) ser++;
    }
    printf("%lld %lld %lld",maxv,minv,ser);
    return 0;
}

#include<stdio.h>
int turn(int x)
{
    if(x==1) return 2;
    else return 1;
}
int main()
{
    int m,n,x,y,flag=0;
    long long int k,row,ans[102]={0},other[102]={0},rec;
    long long int maxv=0,minv,ser;
    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    row=k/m;rec=k%m;
    if(n>2)
    {
        long long int note=(row-1)/(n-1);
        int left=(row-1)%(n-1);
        ans[1]=note/2+1;
        ans[n]=(note-1)/2+1;
        for(int i=2;i<n;i++)
            ans[i]=note;
        if(note%2==0)
        {
            if(rec)
                flag=2+left;
            other[flag]=1;
            for(int i=1;i<=left;i++)
                ans[i+1]++;
        }
        else
        {
            if(rec)
                flag=n-1-left;
            other[flag]=1;
            for(int i=1;i<=left;i++)
                ans[n-i]++;
        }
        for(int i=1;i<=n;i++)
        {
            long long int tem=ans[i]+other[i];
            if(tem>maxv) maxv=tem;
        }
        minv=maxv;
        for(int i=1;i<=n;i++)
            if(ans[i]<minv) minv=ans[i];
        ser=ans[x];
        if(x==flag && y<=k%m) ser++;
    }
    else if(n==1)
    {
        minv=row;
        if(rec)
            maxv=minv+1;
        if(rec<y)
            ser=minv;
        else ser=maxv;
    }
    else if(n==2)
    {
        long long int note[3][2]={0},tem=turn(row%2);
        note[1][0]=note[2][0]=row/2;
        if(row%2) note[1][0]++;
        if(rec)
            note[tem][1]=1;
        for(int i=1;i<3;i++)
            if(note[i][0]+note[i][1]>maxv)
                maxv=note[i][0]+note[i][1];
        minv=maxv;
        for(int i=1;i<3;i++)
            if(note[i][0]<minv)
                minv=note[i][0];
        ser=note[x][0];
        if(tem==x && y<=rec) ser++;
    }
    printf("%lld %lld %lld",maxv,minv,ser);
    return 0;
}

#include<stdio.h>
int turn(int x)
{
    if(x==1) return 2;
    else return 1;
}
int main()
{
    int m,n,x,y,flag=0;
    long long int k,row,ans[102]={0},other[102]={0},rec;
    long long int maxv=0,minv,ser;
    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    row=k/m;rec=k%m;
    if(n>2)
    {
        long long int note=(row-1)/(n-1);
        int left=(row-1)%(n-1);
        ans[1]=note/2+1;
        ans[n]=(note-1)/2+1;
        for(int i=2;i<n;i++)
            ans[i]=note;
        if(note%2==0)
        {
            if(rec)
                flag=2+left;
            other[flag]=1;
            for(int i=1;i<=left;i++)
                ans[i+1]++;
        }
        else
        {
            if(rec)
                flag=n-1-left;
            other[flag]=1;
            for(int i=1;i<=left;i++)
                ans[n-i]++;
        }
        for(int i=1;i<=n;i++)
        {
            long long int tem=ans[i]+other[i];
            if(tem>maxv) maxv=tem;
        }
        minv=maxv;
        for(int i=1;i<=n;i++)
            if(ans[i]<minv) minv=ans[i];
        ser=ans[x];
        if(x==flag && y<=k%m) ser++;
    }
    else if(n==1)
    {
        maxv=minv=row;
        if(rec)
            maxv=minv+1;
        if(rec<y)
            ser=minv;
        else ser=maxv;
    }
    else if(n==2)
    {
        long long int note[3][2]={0},tem=turn(row%2);
        note[1][0]=note[2][0]=row/2;
        if(row%2) note[1][0]++;
        if(rec)
            note[tem][1]=1;
        for(int i=1;i<3;i++)
            if(note[i][0]+note[i][1]>maxv)
                maxv=note[i][0]+note[i][1];
        minv=maxv;
        for(int i=1;i<3;i++)
            if(note[i][0]<minv)
                minv=note[i][0];
        ser=note[x][0];
        if(tem==x && y<=rec) ser++;
    }
    printf("%lld %lld %lld",maxv,minv,ser);
    return 0;
}

#include<stdio.h>
int turn(int x)
{
    if(x==1) return 2;
    else return 1;
}
int main()
{
    int m,n,x,y,flag=0;
    long long int k,row,rec,ans[102]={0},other[102]={0};
    long long int maxv=0,minv,ser;
    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    row=k/m;rec=k%m;
    if(n>2)
    {
        if(row>0)
        {
            long long int note=(row-1)/(n-1);
            int left=(row-1)%(n-1);
            if(note>0)  ans[1]=note/2+1;
            if(note>0)  ans[n]=(note-1)/2+1;
            for(int i=2;i<n;i++)
                ans[i]=note;
            if(note%2==0)
            {
                if(rec)
                    flag=2+left;
                other[flag]=1;
                for(int i=1;i<=left;i++)
                    ans[i+1]++;
            }
            else
            {
                if(rec)
                    flag=n-1-left;
                other[flag]=1;
                for(int i=1;i<=left;i++)
                    ans[n-i]++;
            }
            for(int i=1;i<=n;i++)
            {
                long long int tem=ans[i]+other[i];
                if(tem>maxv) maxv=tem;
            }
            minv=maxv;
            for(int i=1;i<=n;i++)
                if(ans[i]<minv) minv=ans[i];
            ser=ans[x];
            if(x==flag && y<=k%m) ser++;
        }
        else
        {
            maxv=minv=row;
            if(rec)
                maxv=minv+1;
            if(y<=rec && x==1)
                ser=maxv;
            else
                ser=minv;
        }
    }
    else if(n==1)
    {
        maxv=minv=row;
        if(rec)
            maxv=minv+1;
        if(y<=rec)
            ser=maxv;
        else ser=minv;
    }
    else if(n==2)
    {
        long long int note[3][2]={0};
        int tem=turn(row%2);
        note[1][0]=note[2][0]=row/2;
        if(row%2) note[1][0]++;
        if(rec)
            note[tem][1]=1;
        for(int i=1;i<3;i++)
            if(note[i][0]+note[i][1]>maxv)
                maxv=note[i][0]+note[i][1];
        minv=maxv;
        for(int i=1;i<3;i++)
            if(note[i][0]<minv)
                minv=note[i][0];
        ser=note[x][0];
        if(tem==x && y<=rec) ser++;
    }
    printf("%lld %lld %lld",maxv,minv,ser);
    return 0;
}

#include <stdint.h>
#include <stdio.h>

int main() {
    uint8_t n, m, x, y;
    uint64_t k;
    scanf("%hhu %hhu %I64u %hhu %hhu", &n, &m, &k, &x, &y);
    uint64_t t, seryo, mini, maxi;
    if (n == 1) {
        t = k / m;
        mini = t;
        k -= t * m;
        maxi = t + (k > 0);
        seryo = t + (k >= y);
        goto END;
    }
    if (n == 2) {
        t = k / (2 * m);
        mini = t;
        k -= t * 2 * m;
        maxi = t + (k > 0);
        seryo = t + (k >= (x - 1) * m + y);
        goto END;
    }
    t = k / ((n - 1) * m);
    k -= t * (n - 1) * m;
    uint64_t mid_row = t;
    uint64_t first_row = (t + 1) / 2;
    uint64_t last_row = t / 2;
    mini = last_row;
    maxi = (t == 0) ? (k > 0) : mid_row + (k > m);
    if (x == 1)
        seryo = first_row;
    else if (x == n)
        seryo = last_row;
    else
        seryo = mid_row;
    if (t % 2 == 0) /* then we start counting from first row */
        seryo += (k >= (x - 1) * m + y);
    else {
        mini += (k >= m);
        seryo += (k >= (n - x) * m + y);
    }
END:
    printf("%I64u %I64u %I64u\n", maxi, mini, seryo);
    return 0;
}

#include<stdio.h>
long long k,round,min,max,val,tmp;
int n,m,x,y,rem,tmpx,tmpy;//xΪ������yΪ����
int a[110][110];
int main(){
	scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
	if(n>1){
		round=k/(m*(2*n-2));
	    rem=k%(m*(2*n-2));
	    int dir=1;
	    tmpx=1;tmpy=1;
	    while(rem>0){
	    	a[tmpx][tmpy]++;
	    	rem--;
	    	if(tmpy<m)tmpy++;
	    	else {
			    if(tmpx+dir>n||tmpx+dir<1)dir=-dir;
			    tmpx=tmpx+dir;
			    tmpy=1;
			}
		}
		int i,j;

		max=0;min=k;
		for(i=1;i<=n;i++)
		 for(j=1;j<=m;j++){
		 	 if(i==1||i==n)tmp=round+a[i][j];
		 	 else tmp=round*2+a[i][j];
		 	 if(tmp>max)max=tmp;
		 	 if(tmp<min)min=tmp;
		 	 if(i==x&&j==y)val=tmp;
		 }
	}
	else{
		round=k/m;
		rem=k%m;
		if(rem>0){
			max=round+1;
			min=round;
			if(rem>=y)val=round+1;
			else val=round;
		}
	}
	printf("%lld %lld %lld",max,min,val);
	return 0;
}

//今天晚上没有BUG！！！
//今天晚上没有BUG！！！
//今天晚上没有BUG！！！
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
long long a[105][105];
int main()
{
    int n,m,x,y;
    long long k;
    scanf("%d %d %lld %d %d",&n,&m,&k,&x,&y);
    long long shang,yushu;
    int numb1=(n-1)*m;
    if (n==1)
    {
        shang=k/(n*m);
        yushu=k%(n*m);
        int mm,jj;
        for (mm=1;mm<=m;mm++)
            a[1][mm]=shang;
        for (mm=1;mm<=yushu;mm++)
            a[1][mm]++;
        long long maxx=0,minn=1000000000000000000;
        for (jj=1;jj<=m;jj++)
        {
            maxx=maxx>a[1][jj]? maxx:a[1][jj];
            minn=minn<a[1][jj]? minn:a[1][jj];
        }
        printf("%lld %lld %lld",maxx,minn,a[x][y]);
        return 0;
    }
    shang=k/numb1;
    yushu=k%numb1;
    int i,j;
    for (i=1;i<=n;i++)
    {
        for (j=1;j<=m;j++)
            a[i][j]=shang/2;
    }
    for (i=2;i<n;i++)
    {
        for (j=1;j<=m;j++)
            a[i][j]+=shang/2;
    }
    if (shang%2)
    {
        for (i=1;i<n;i++)
        {
            for (j=1;j<=m;j++)
                a[i][j]++;
        }
    }
    i=1;
    while (yushu>0&&(shang%2==0))//先后顺序
    {
        for (j=1;j<=m;j++)
        {
            if (yushu>0)
            {
                a[i][j]++;
                yushu--;
            }
        }
        i++;
    }
    i=n;
    while (yushu>0&&(shang%2!=0))//先后顺序
    {
        for (j=1;j<=m;j++)
        {
            if (yushu>0)
            {
                a[i][j]++;
                yushu--;
            }
        }
        i--;
    }
    long long maxx=0,minn=1000000000000000000;
    for (i=1;i<n;i++)
    {
        for (j=1;j<=m;j++)
        {
            maxx=maxx>a[i][j]? maxx:a[i][j];
            minn=minn<a[i][j]? minn:a[i][j];
        }
    }
    printf("%lld %lld %lld",maxx,minn,a[x][y]);
    return 0;
}

#include <stdio.h>

typedef long long INT64;

int main(void) {
    INT64 i = 0, j = 0, n = 0, m = 0, k = 0;
    INT64 x = 0, y = 0, arr[101] = {0, }, cnt = 0;
    INT64 serg = 0, max = 0, min = -1;

    scanf("%lld %lld %lld %lld %lld", &n, &m, &k, &x, &y);
    INT64 q = k / m;
    INT64 r = k % m;
    if (n == 1) {
        if (y <= r) {
            serg = q + 1;
        } else {
            serg = q;
        }

        min = q;

        if (r == 0) {
            max = q;
        } else {
            max = q + 1;
        }
    } else {
        cnt = q / (2 * (n - 1));
        arr[1] = arr[n] = cnt;
        k -= (2 * (n - 1)) * cnt * m;
        for (i=2;i<=n-1;i++) {
            arr[i] = 2 * cnt;
        }

        for (i=1;i<=n;i++) {
            if (k < m) {
                break;
            }

            arr[i]++;
            k -= m;
        }

        if (i > n) {
            for (i=n-1;i>1;i--) {
                if (k < m) {
                    break;
                }

                arr[i]++;
                k -= m;
            }
        }

        if (k != 0) {
            arr[i]++;
        }

        for (j=1;j<=n;j++) {
            if (arr[j] > max) {
                max = arr[j];
            }

            if (min < 0 || arr[j] < min) {
                if (j == i) {
                    if (k == 0) {
                        min = arr[j];
                    } else {
                        min = arr[j] - 1;
                    }
                } else {
                    min = arr[j];
                }
            }
        }

        if (x != i) {
            serg = arr[x];
        } else {
            if (k == 0 || y <= k) {
                serg = arr[i];
            } else {
                serg = arr[i] - 1;
            }
        }
    }

    printf("%lld %lld %lld\n", max, min, serg);

    return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

long long int max(long long int a,long long int b)
{
    if(a>b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=min(arr[1],arr[n]);

           maximum=0;

           for(i=1;i<n+1;i++)
           maximum=max(maximum,arr[i]);

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            printf("%lld %lld %lld\n",minimum,maximum,remaining_questions);

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=min(arr[1],arr[n]);

            if(remaining_questions==n*m)
            maximum=arr[2];

            else
            maximum=arr[last_x];

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

long long int max(long long int a,long long int b)
{
    if(a>b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp,j;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=arr[1];

            for(i=1;i<n+1;i++)
            minimum=min(minimum,arr[i]);

            if(remaining_questions<n*m && remaining_questions>=(n*m)-m)
            minimum--;

           maximum=0;

           for(i=1;i<n+1;i++)
           maximum=max(maximum,arr[i]);

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=min(arr[1],arr[n]);

            if(remaining_questions==n*m)
            maximum=arr[2];

            else
            maximum=arr[last_x];

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=min(arr[1],arr[n]);

            if(remaining_questions==n*m)
            maximum=arr[2];

            else
            maximum=arr[last_x];

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

long long int max(long long int a,long long int b)
{
    if(a>b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=arr[1];

            for(i=1;i<n+1;i++)
            minimum=min(minimum,arr[i]);

            if(remaining_questions<=n*m && remaining_questions>=(n*m)-m)
            minimum--;

           maximum=0;

           for(i=1;i<n+1;i++)
           maximum=max(maximum,arr[i]);

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=min(arr[1],arr[n]);

            if(last_x==1 || last_x==n)
            maximum=arr[2];

            else
            maximum=arr[last_x];

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include<stdio.h>

long long int min(long long int a,long long int b)
{
    if(a<b)
    return a;

    else
    return b;
}

long long int max(long long int a,long long int b)
{
    if(a>b)
    return a;

    else
    return b;
}

int main()
{
    long long int questions,n,m,x,y,period,maximum,minimum,sergei_questions,last_x,last_y,remaining_questions,temp,j;

    scanf("%lld %lld %lld %lld %lld",&n,&m,&questions,&x,&y);

    if(n==1 || n==2)
    {
        period=n*m;

        if(questions%period==0)
        printf("%lld %lld %lld\n",questions/period,questions/period,questions/period);

        else
        {
            maximum=questions/period+1;
            minimum=questions/period;

            last_x=(questions%period)/m;
            last_y=(questions%period)%m;

                if(last_y!=0)
                last_x++;

                else
                last_y=m;

                if(x<last_x || (x==last_x && y<=last_y))
                sergei_questions=maximum;

                else
                sergei_questions=minimum;

                printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

    else
    {
        period=(n*m)+((n-2)*m);

        if(questions%period==0)
        {
            minimum=questions/period;
            maximum=2*minimum;

            if(x==1 || x==n)
            sergei_questions=minimum;

            else
            sergei_questions=maximum;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }

        else
        {
            minimum=questions/period;
            maximum=2*minimum;

            remaining_questions=questions%period;
            temp=remaining_questions;

            long long int arr[n+1],i;

            for(i=1;i<n+1;i++)
            {
                if(i==1 || i==n)
                arr[i]=minimum;

                else
                arr[i]=maximum;
            }

            if(remaining_questions<=n*m)
            {
               i=1;

               while(temp>0)
               {
                    arr[i]++;
                    temp=temp-m;
                    i++;
               }
            }

            else
            {
                for(i=1;i<n+1;i++)
                arr[i]++;

                temp=remaining_questions-(n*m);

                i=n-1;

                while(temp>0)
                {
                    arr[i]++;
                    temp=temp-m;
                    i--;
                }
            }

            last_x=remaining_questions/m;
            last_y=remaining_questions%m;

            if(last_y!=0)
            last_x++;

            else
            last_y=m;

            if(last_x>n)
            last_x=2*n-last_x;

            minimum=arr[1];

            for(i=1;i<n+1;i++)
            minimum=min(minimum,arr[i]);

            if(remaining_questions<=n*m && remaining_questions>=(n*m)-m)
            minimum--;

           maximum=0;

           for(i=1;i<n+1;i++)
           maximum=max(maximum,arr[i]);

            sergei_questions=arr[x];

            if(x==last_x && y>last_y)
            sergei_questions--;

            printf("%lld %lld %lld\n",maximum,minimum,sergei_questions);

        }
    }

return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);
    x--;
    if(n*m > k)
    {
           max = 1;
           min = 0;
           if(x*m+y <= k)S = 1;
           else S = 0;
    }
    else if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(k/(m*2)%2 == 0)
                 {
                              if(k%(m*2) >= x*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if(x*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(k/(m*2)%2 == 0)
                 {
                              if(k%(m*2) >= x*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if(x*m+y <= j)S = max+1;
                      else S = max;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(k/(m*2)%2 == 0)
                 {
                              if(k%(m*2) >= x*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if(x*m+y <= j)S = max+1;
                      else S = max;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-2))S++;
                        else if(x + j/m == (n-2))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n*m > k)
    {
           max = 1;
           min = 0;
           if((x-1)*m+y <= k)S = 1;
           else S = 0;
    }
    else if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 j = k%(m*n);
                 if(j > m)
                 {
                            if(x == 2 && j-m >= y)S = max;
                            else S = min;
                 }
                 else
                 {
                     if(x == 1 && j >= y)S = max;
                     else S = min;
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if((x-1)*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n*m > k)
    {
           max = 1;
           min = 0;
           if((x-1)*m+y <= k)S = 1;
           else S = 0;
    }
    else if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(k/(m*2)%2 == 0)
                 {
                              if(k%(m*2) >= x*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if((x-1)*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(k/(m*2)%2 == 0)
                 {
                              if(k%(m*2) >= x*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if((x-1)*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n*m > k)
    {
           max = 1;
           min = 0;
           if((x-1)*m+y <= k)S = 1;
           else S = 0;
    }
    else if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(min%2 == 0)
                 {
                              if(k%(m*2) >= (x-1)*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if((x-1)*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>
#include <stdlib.h>

long long int k,i,j,max,min,S;

int main()
{
    int n,m,x,y;

    scanf("%d%d%lld%d%d",&n,&m,&k,&x,&y);

    if(n <= 2)
    {
         min = k/(m*n);
         max = (k%(m*n) == 0)?min:min + 1;

         if(max == min)S = max;
         else
         {
             if(n == 1)
             {
                  if(k%m >= y)S = max;
                  else S = min;
             }
             else
             {
                 if(k/(m*2)%2 == 0)
                 {
                              if(k%(m*2) >= x*m+y)S = max;
                              else S = min;
                 }
                 else
                 {
                     if(k%(m*2) <= m)
                     {
                                if(x == 2 && k%(m*2) >= y)S = max;
                                else S = min;
                     }
                     else
                     {
                         if(x == 1 && k%m <= y)S = min;
                         else S = max;
                     }
                 }
             }
         }
    }
    else
    {
        i = k/(m*(2*n-2));
        j = k%(m*(2*n-2));
        max = i*2;
        min = i;
        if(j == 0)
        {
             if(x == 1 || x == n)S = min;
             else S = max;
        }
        else
        {
            if(j <= m)
            {
                 if(x == 1)
                 {
                      if(y > j)S = min;
                      else S = min+1;
                 }
                 else if(x == n)S = min;
                 else S = max;
            }
            else if(j <= m*(n-1))
            {
                 max++;
                 if(x == 1)S = min+1;
                 else if(x == n)S = min;
                 else
                 {
                      if(x*m+y <= j)S = max;
                      else S = max-1;
                 }
            }
            else if(j <= m*n)
            {
                 max++;
                 if(j == m*n)min++;
                 if(x == 1)S = i+1;
                 else if(x == n)
                 {
                      if(y <= j%m || j%m == 0)S = i+1;
                      else S = i;
                 }
                 else S = max;
            }
            else
            {
                max+=2;
                min++;
                if(x == 1)S = i+1;
                else if(x == n)S = i+1;
                else
                {
                    S = i*2+1;
                    j-=m*n;
                    if(j%m == 0)
                    {
                           if(x + j/m > (n-2))S++;
                    }
                    else
                    {
                        if(x + j/m > (n-1))S++;
                        else if(x + j/m == (n-1))
                        {
                             if(j%m >= y||j%m == 0)S++;
                        }
                    }
                }
            }
        }
    }

    printf("%lld %lld %lld\n",max,min,S);
}

#include <stdio.h>

int n, m;

long long count(int x, int y, long long k) {
	long long z;

	if (n <= 2) {
		z = k / (n * m);
		k %= n * m;
		if ((x - 1) * m + y <= k)
			z++;
	} else {
		z = k / ((n + n - 2) * m);
		if (x > 1 && x < n)
			z *= 2;
		k %= (n + n - 2) * n;
		if ((x - 1) * m + y <= k)
			z++;
		if (x > 1 && x < n && (n - 1 - x) * m + y <= k - n * m)
			z++;
	}
	return z;
}

long long max2(long long a, long long b) {
	return a > b ? a : b;
}

long long min2(long long a, long long b) {
	return a < b ? a : b;
}

int main() {
	int x, y;
	long long k, max, min, ser;

	scanf("%d%d%lld%d%d", &n, &m, &k, &x, &y);
	max = n <= 2 ? count(1, 1, k) : max2(max2(count(1, 1, k), count(2, 1, k)), max2(count(n - 1, 1, k), count(n, 1, k)));
	min = n <= 2 ? count(n, m, k) : min2(min2(count(1, m, k), count(2, m, k)), min2(count(n - 1, m, k), count(n, m, k)));
	ser = count(x, y, k);
	printf("%lld %lld %lld\n", max, min, ser);
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define dll unsigned long long

#define SIZE 105

int n, m, x, y;
dll k, ans[SIZE][SIZE];

int main()
{
	int i, j;
	dll max = 0, min = 18446744073709551615, full_come, total_comes;

	scanf("%d %d %I64u %d %d", &n, &m, &k, &x, &y);

	full_come = n * m;
	if (n > 2)
		full_come += (n - 2) * m;

	total_comes = k / full_come;

	k %= full_come;

	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
		{
			ans[i][j] += total_comes;
			if (i > 0 && i < n - 1)
				ans[i][j] += total_comes;
		}

	for (i = 0; i < n; i++)
		for (j = 0; j < m && k > 0; j++)
		{
			ans[i][j]++;
			k--;
		}

	for (i = n - 1; i > 0; i--)
		for (j = 0; j < m && k > 0; j++)
		{
			ans[i][j]++;
			k--;
		}

	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
		{
			if (ans[i][j] > max)
				max = ans[i][j];
			if (ans[i][j] < min)
				min = ans[i][j];
		}

	printf("%I64u %I64u %I64u", max, min, ans[x - 1][y - 1]);

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define dll long long

#define SIZE 100
#define INF 9000000000000000000

int n, m, x, y;
dll k, ans[SIZE][SIZE];

int main()
{
	int i, j;
	dll  max = 0, min = INF, full_come, total_comes;

	scanf("%d %d %I64d %d %d", &n, &m, &k, &x, &y);

	full_come = n * m;
	if (n > 2)
		full_come += (n - 2) * m;

	total_comes = k / full_come;

	k %= full_come;

	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
		{
			ans[i][j] += total_comes;
			if (i > 0 && i < n - 1)
				ans[i][j] += total_comes;
		}

	/*for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
			printf("%I64d ", ans[i][j]);
		printf('\n');
	}*/

	for (i = 0; i < n; i++)
		for (j = 0; j < m && k > 0; j++)
		{
			ans[i][j]++;
			k--;
		}

	for (i = n - 1; i > 0; i--)
		for (j = 0; j < m && k > 0; j++)
		{
			ans[i][j]++;
			k--;
		}

	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
		{
			if (ans[i][j] > max)
				max = ans[i][j];
			if (ans[i][j] < min)
				min = ans[i][j];
		}

	printf("%I64d %I64d %I64d", max, min, ans[x - 1][y - 1]);

	return 0;
}

#include<stdio.h>
int main()
{
    int n,m,x,y;
    long long int k,p,min,max,cur,g;
    scanf("%d %d %I64d %d %d",&n,&m,&k,&x,&y);
    if(n==1)
    {
       p=k/m;
       g=k%(long long)m;
       min=p;
       if(g>0)
        max=p+1;
       else
        max=p;
       if(g>=y)
        cur=p+1;
       else
        cur=g;
    }
    else
    {
        p=k/((long long)((n-1)*m));
        g=k%((long long)((n-1)*m));
       if(p%2==0)
       {
           if(g>m)
            max=p+1;
           else
            max=p;
           min=p/2;
           if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==n)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(x-1)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
       else
       {
          if(g>=m)
            min=p/2+1;
          else
            min=p/2;
          if(g>m)
            max=p+1;
          else
           max=p;
          if(x==1)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+2;
               else
                cur=p/2+1;
           }
           else if(x==n)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(n-x)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
    }
    printf("%I64d %I64d %I64d",max,min,cur);
}

#include<stdio.h>
int main()
{
    int n,m,x,y;
    long long int k,p,min,max,cur,g;
    scanf("%d %d %I64d %d %d",&n,&m,&k,&x,&y);
    if(n==1)
    {
       p=k/m;
       g=k%(long long)m;
       min=p;
       if(g>0)
        max=p+1;
       else
        max=p;
       if(g>=y)
        cur=p+1;
       else
        cur=g;
    }
    else if(n==2)
    {
        p=k/((long long)m);
        g=k%((long long)m);
        if(p%2==0)
        {
            if(g>0)
            max=p/2+1;
            else
            max=p/2;
            min=p/2;
            if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==2)
           {
                cur=p/2;
           }
        }
        else
        {
            max=p/2+1;
            min=p/2;
            if(x==1)
           {
                cur=p/2+1;
           }
           else if(x==2)
           {
                if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
        }
    }
    else
    {
        p=k/((long long)((n-1)*m));
        g=k%((long long)((n-1)*m));
       if(p%2==0)
       {
           if(g>m)
            max=p+1;
           else
            max=p;
           min=p/2;
           if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==n)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(x-1)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
       else
       {
          if(g>=m)
            min=p/2+1;
          else
            min=p/2;
          if(g>m)
            max=p+1;
          else
           max=p;
          if(x==1)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+2;
               else
                cur=p/2+1;
           }
           else if(x==n)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(n-x)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
    }
    printf("%I64d %I64d %I64d",max,min,cur);
}

#include<stdio.h>
int main()
{
    int n,m,x,y;
    long long int k,p,min,max,cur,g;
    scanf("%d %d %I64d %d %d",&n,&m,&k,&x,&y);
    if(n==1)
    {
       p=k/m;
       g=k%(long long)m;
       min=p;
       if(g>0)
        max=p+1;
       else
        max=p;
       if(g>=y)
        cur=p+1;
       else
        cur=g;
    }
    else if(n==2)
    {
        p=k/((long long)m);
        g=k%((long long)m);
        if(p%2==0)
        {
            if(g>0)
            max=p/2+1;
            else
            max=p/2;
            min=p/2;
            if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==2)
           {
                cur=p/2;
           }
        }
        else
        {
            max=p/2+1;
            min=p/2;
            if(x==1)
           {
                cur=p/2+1;
           }
           else if(x==2)
           {
                if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
        }
    }
    else
    {
        p=k/((long long)((n-1)*m));
        g=k%((long long)((n-1)*m));
        if(p==0)
        {
            max=1;
            min=0;
            if(g>=(x-1)*m+y)
            cur=1;
            else
            cur=0;
        }
       else if(p%2==0)
       {
           if(g>m)
            max=p+1;
           else
            max=p;
           min=p/2;
           if(x==1)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else if(x==n)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(x-1)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
       else
       {
          if(g>=m)
            min=p/2+1;
          else
            min=p/2;
          if(g>m)
            max=p+1;
          else
           max=p;
          if(x==1)
           {
               if(g>=(n-1)*m+y)
                cur=p/2+2;
               else
                cur=p/2+1;
           }
           else if(x==n)
           {
               if(g>=y)
                cur=p/2+1;
               else
                cur=p/2;
           }
           else
           {
               if(g>=(n-x)*m+y)
                cur=p+1;
               else
                cur=p;
           }
       }
    }
    printf("%I64d %I64d %I64d",max,min,cur);
}

#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
    long long j,i,count,n,m,k,x,y,a[110]={0},ans,max,min;
    scanf("%lld%lld%lld%lld%lld",&n,&m,&k,&x,&y);
    if(n==1)
    {
        if(y<=k%m)
            ans=k/m+1;
        else
            ans=k/m;
        if(k%m!=0)
            printf("%lld %lld %lld\n",k/m+1,k/m,ans);
        else
            printf("%lld %lld %lld\n",k/m,k/m,k/m);
        return 0;
    }
    count=((k/m)/(2*n-2));
    a[1]=count;
    a[n]=count;
    k=k-(2*n-2)*count*m;
    for(i=2;i<=n-1;i++)
        a[i]=2*count;
    for(i=1;i<=n;i++)
    {
        if(k<m)
            break;
        a[i]++;
        k-=m;
    }
    if(i==n+1)
    {
        for(i=n-1;i>1;i--)
        {
            if(k<m)
                break;
            a[i]++;
            k-=m;
        }
    }
    j=i;
    min=1000000000000000000;
    max=0;
    if(k!=0)
        a[i]++;
    for(i=1;i<=n;i++)
    {
        if(a[i]>max)
            max=a[i];
        if(a[i]<min)
        {
            if(i==j)
                min=a[i]+1;
            else
                min=a[i];
        }
    }
    if(x!=j)
        ans=a[x];
    else
    {
        if(k==0)
            ans=a[j];
        else if(y<=k)
            ans=a[j];
        else
            ans=a[j]-1;
    }
    printf("%lld %lld %lld\n",max,min,ans);
    return 0;
}

#include<stdio.h>

int main()
{
	long long n,m,x,y;
	long long k;
    scanf("%I64d %I64d %I64d %I64d %I64d",&n,&m,&k,&x,&y);
    long long sb1,sb2;
    sb1=(x-1)*m+y;
    sb2=(n-x)*m+y;
    long long s=k/(n*m),h=k%(n*m);
    if(h==0)
    printf("%I64d %I64d %I64d",s,s,s);
    else if(h%2==0)
    {
    	printf("%I64d %I64d ",s+1,s);
    	if(h>=sb2)
    	printf("%I64d",s+1);
    	else
    	printf("%I64d",s);
    }
    else if(h%2==1)
    {
    	printf("%I64d %I64d ",s+1,s);
    	if(h>=sb1)
    	printf("%I64d",s+1);
    	else
    	printf("%I64d",s);
    }
	return 0;
}