usingnamespace std; #define MAXN 5006 //#define int long long #define rep( i , a , b ) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per( i , a , b ) for (int i = (a), i##end = (b); i >= i##end; --i) #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define vi vector<int> #define all( x ) (x).begin() , (x).end() #define mem( a ) memset( a , 0 , sizeof a ) typedeflonglong ll; #define P 1000000007 int n , m , q; int A[200006] , B[200006]; int dp[MAXN][MAXN] , tar[MAXN][MAXN] , J[200006] , iJ[200006];
intC( int x , int y ){ return J[x] * 1ll * iJ[y] % P * iJ[x - y] % P; } intPow( int x , int a ){ int ret = 1; while( a ) { if( a & 1 ) ret = ret * 1ll * x % P; x = x * 1ll * x % P , a >>= 1; } return ret; }
voidsolve( ){ cin >> n; int S = 2006; int res = 0; J[0] = iJ[0] = 1; rep( i , 1 , 200000 ) J[i] = J[i - 1] * 1ll * i % P , iJ[i] = Pow( J[i] , P - 2 ); rep( i , 1 , n ) { scanf("%d%d",A + i,B + i) , ++ dp[S - A[i]][S - B[i]] , ++ tar[S + A[i]][S + B[i]]; res = ( res + P - C( A[i] + B[i] + A[i] + B[i] , A[i] + A[i] ) ) % P; } rep( i , 1 , S * 2 ) rep( j , 1 , S * 2 ) { ( dp[i][j] += ( dp[i - 1][j] + dp[i][j - 1] ) % P ) %= P; if( tar[i][j] ) res = ( res + tar[i][j] * 1ll * dp[i][j] ) % P; } cout << res * 1ll * ( ( P + 1 ) / 2 ) % P << endl; }