#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int h,w; cin>>h>>w; int si,sj,gi,gj; cin>>si>>sj>>gi>>gj; si--;gi--;sj--;gj--; int ans = 0; vector> cnt(h,vector(w,0)); int dx[] = {1,-1,0,0}; int dy[] = {0,0,1,-1}; auto dfs = [&](auto dfs,int x,int y) -> void { int now = 0; for(int k = 0;k<4;k++){ int nx = x + dx[k]; int ny = y + dy[k]; if(nx<0||nx>=h||ny<0||ny>=w) continue; if(cnt[nx][ny]) now++; } if(now>=2) return; if(x==gi&&y==gj){ ans++; return; } cnt[x][y]++; for(int k = 0;k<4;k++){ int nx = x + dx[k]; int ny = y + dy[k]; if(nx<0||nx>=h||ny<0||ny>=w) continue; if(cnt[nx][ny]) continue; dfs(dfs,nx,ny); } cnt[x][y]--; }; dfs(dfs,si,sj); cout<