#include <bits/stdc++.h>
using namespace std;
int point_x, point_y, horse_x, horse_y;
struct mtype
{
int num;
bool have_visted = false;
} memory[1001][1001];
inline bool memcheck(int x, int y, int &num, bool save_or_read)
{
if (save_or_read)
{
memory[x][y].num = num;
memory[x][y].have_visted = true;
return true;
}
else
{
if (memory[x][y].have_visted)
{
num = memory[x][y].num;
return true;
}
else
return false;
}
}
inline bool check(int x, int y)
{
if (x == horse_x and y == horse_y)
return false;
if (x == horse_x - 2)
{
if (y == horse_y - 1)
return false;
else if (y == horse_y + 1)
return false;
}
if (x == horse_x + 2)
{
if (y == horse_y - 1)
return false;
else if (y == horse_y + 1)
return false;
}
if (x == horse_x - 1)
{
if (y == horse_y - 2)
return false;
else if (y == horse_y + 2)
return false;
}
if (x == horse_x + 1)
{
if (y == horse_y - 2)
return false;
else if (y == horse_y + 2)
return false;
}
return true;
}
int run(int x, int y)
{
int ret=0;
if(x==0 or y==0)
return 1;
if(memcheck(x,y,ret,false))
return ret;
if(!check(x,y))
return 0;
ret=run(x - 1, y) + run(y - 1, x);
memcheck(x,y,ret,true);
return ret;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> point_x >> point_y >> horse_x >> horse_y;
cout << run(point_x, point_y) << endl;
return 0;
}
谢谢大佬!