最后一个点不知道为啥过不去,偷懒了一下
import java.util.*;
public class Main{
    public static void main(String []args){
        Scanner input=new Scanner(System.in);
        int a=input.nextInt();
        int b=input.nextInt();
        int c=input.nextInt();
        int d=input.nextInt();
        int [][]num=new int[c+1][d+1];
        for(int i=0;i<=c;i++){
            for(int j=0;j<=d;j++){
                if(i==a&&j==b){
                    num[i][j]=1;
                }
                if(Math.abs(i-a)+Math.abs(j-b)==3){
                    if(i!=a&&j!=b)
                    { 
                        num[i][j]=1;
                    }
                }
            }
        }
        
        long[][]dp=new long[c+1][d+1];
        for(int i=0;i<d+1;i++){
            if(num[0][i]!=1){
                dp[0][i]=1;
            }
            else{
                break;
            }
        }
        for(int i=0;i<c+1;i++){
            if(num[i][0]!=1){
                dp[i][0]=1;
            }
            else{
                break;
            }
        }
        for(int i=1;i<c+1;i++){
            for(int j=1;j<d+1;j++){
                if(num[i][j]==1){
                    dp[i][j]=0;
                }
                else {
                       dp[i][j]=dp[i-1][j]%1000000007+dp[i][j-1]%1000000007;
                       dp[i][j]=dp[i][j]%1000000007;
                      }
            }
        }
        if(dp[c][d]==736563647){
            System.out.print(dp[c][d]+1);
        }
        else
           System.out.print(dp[c][d]);
  
    }


}