문제링크
import java.io.BufferedReader
import java.io.BufferedWriter
import kotlin.math.abs
private lateinit var bufferedReader: BufferedReader
private lateinit var bufferedWriter: BufferedWriter
fun main() {
bufferedReader = System.`in`.bufferedReader()
bufferedWriter = System.out.bufferedWriter()
val (w, h) = bufferedReader
.readLine()
.split(" ")
.map { it.toInt() }
var (p, q) = bufferedReader
.readLine()
.split(" ")
.map { it.toInt() }
val t = bufferedReader.readLine().toInt()
p = w - abs(w - (p + t) % (2 * w))
q = h - abs(h - (q + t) % (2 * h))
bufferedWriter.write("$p $q")
bufferedReader.close()
bufferedWriter.close()
}