import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;

immutable int MOD = 1_000_000_007;
immutable int MAX_N = 8001;

void main ()
{
	auto c = new int [] [MAX_N];
	foreach (i; 0..MAX_N)
	{
		c[i] = new int [i / 2 + 1];
		c[i][0] = 1;
		for (int j = 1; j + j <= i; j++)
		{
			c[i][j] = c[i - 1][j - 1] +
			    c[i - 1][min (j, i - j - 1)];
			if (c[i][j] >= MOD)
			{
				c[i][j] -= MOD;
			}
		}
	}

	int n;
	while (readf (" %s", &n) > 0)
	{
		alias Pack = Tuple !(int, q{a}, int, q{b});
		auto p = new Pack [n];
		foreach (ref q; p)
		{
			readf (" %s %s", &q.a, &q.b);
			q = Pack (q.a + q.b, min (q.a, q.b));
		}

		long res = 0;
		foreach (i; 0..n)
		{
			foreach (j; i + 1..n)
			{
				res += c[p[i].a + p[j].a][p[i].b + p[j].b];
			}
			res %= MOD;
		}
		writeln (res);
	}
}
