https://www.acmicpc.net/problem/10158
using System;
class Program
{
static void Main() {
string[] s=Console.ReadLine().Split(' ');
string[] s1=Console.ReadLine().Split(' ');
string s2=Console.ReadLine();
int w=int.Parse(s[0]);
int h=int.Parse(s[1]);
int p=int.Parse(s1[0]);
int q=int.Parse(s1[1]);
int t=int.Parse(s2);
int x=t%(2*w);
int y=t%(2*h);
if(x<=w-p) p+=x;
else if(x<=2*w-p) p=w-(x-w+p);
else p=x-2*w+p;
if(y<=h-q) q+=y;
else if(y<=2*h-q) q=h-(y-h+q);
else q=y-2*h+q;
Console.Write("{0} {1}",p,q);
}
}