import std.stdio;
import std.bigint;
import std.functional;
uint n = 100;
uint m = 100;
uint x1 = 60;
uint y1 = 60;
uint k = 100;
alias memstep = memoize!(step, 100 * 100 * 200);
BigInt step(uint x, uint y, uint k){
if (k==0) {
return ((x==x1) && (y==y1)) ? BigInt("1") : BigInt("0");
}
else {
auto up = (y+1 < m) ? memstep(x, y+1, k-1) : BigInt("0");
auto down = (y-1 >= 0) ? memstep(x, y-1, k-1) : BigInt("0");
auto left = (x+1 < n) ? memstep(x+1, y, k-1) : BigInt("0");
auto right = (x-1 >= 0) ? memstep(x-1, y, k-1) : BigInt("0");
return up + down + left + right;
}
}
void main()
{
step(50, 50, 200).writeln;
}
aW1wb3J0IHN0ZC5zdGRpbzsKaW1wb3J0IHN0ZC5iaWdpbnQ7CmltcG9ydCBzdGQuZnVuY3Rpb25hbDsKCnVpbnQgbiA9IDEwMDsKdWludCBtID0gMTAwOwkKdWludCB4MSA9IDYwOwp1aW50IHkxID0gNjA7CnVpbnQgayA9IDEwMDsKCmFsaWFzIG1lbXN0ZXAgPSBtZW1vaXplIShzdGVwLCAxMDAgKiAxMDAgKiAyMDApOwoKQmlnSW50IHN0ZXAodWludCB4LCB1aW50IHksIHVpbnQgayl7CgoJaWYgKGs9PTApIHsKCQlyZXR1cm4gKCh4PT14MSkgJiYgKHk9PXkxKSkgPyBCaWdJbnQoIjEiKSA6IEJpZ0ludCgiMCIpOwoJfQoJZWxzZSB7CgkJYXV0byB1cCAgICA9ICh5KzEgPCBtKSA/IG1lbXN0ZXAoeCwgeSsxLCBrLTEpIDogQmlnSW50KCIwIik7CgkJYXV0byBkb3duICA9ICh5LTEgPj0gMCkgPyBtZW1zdGVwKHgsIHktMSwgay0xKSA6IEJpZ0ludCgiMCIpOwoJCWF1dG8gbGVmdCAgPSAoeCsxIDwgbikgPyBtZW1zdGVwKHgrMSwgeSwgay0xKSA6IEJpZ0ludCgiMCIpOwoJCWF1dG8gcmlnaHQgPSAoeC0xID49IDApID8gbWVtc3RlcCh4LTEsIHksIGstMSkgOiBCaWdJbnQoIjAiKTsKCgkJcmV0dXJuIHVwICsgZG93biArIGxlZnQgKyByaWdodDsKCX0KfQoKdm9pZCBtYWluKCkKewoJc3RlcCg1MCwgNTAsIDIwMCkud3JpdGVsbjsKfQ==