#include <stdio.h>
#include <algorithm>
long long p = 1000000007;
long long ans = 1;
long long d = 4294967296;
long long gcd(long long gcd_a, long long gcd_b) {
	if (gcd_a < gcd_b) {
		long long gcd_c;
		gcd_c = gcd_a;
		gcd_a = gcd_b;
		gcd_b = gcd_c;
	}
	if (!gcd_b)return gcd_a;
	return gcd(gcd_b, gcd_a % gcd_b);
}
struct two {
	long long x;
	long long y;
	bool operator<(two f){
		long long hx[3], hy[3];
		long long px[2], py[2];
		px[0] = y / d;
		px[1] = y % d;
		py[0] = f.x / d;
		py[1] = f.x % d;
		hx[0] = px[0] * py[0];
		hx[1] = px[0] * py[1] + px[1] * py[0];
		hx[2] = px[1] * py[1];
		hx[1] += hx[2] / d;
		hx[2] %= d;
		hx[0] += hx[1] / d;
		hx[1] %= d;

		px[0] = x / d;
		px[1] = x % d;
		py[0] = f.y/ d;
		py[1] = f.y % d;
		hy[0] = px[0] * py[0];
		hy[1] = px[0] * py[1] + px[1] * py[0];
		hy[2] = px[1] * py[1];
		hy[1] += hy[2] / d;
		hy[2] %= d;
		hy[0] += hy[1] / d;
		hy[1] %= d;
		if (hx[0] < hy[0])return true;
		if (hx[0] > hy[0])return false;
		if (hx[1] < hy[1])return true;
		if (hx[1] > hy[1])return false;
		if (hx[2] < hy[2])return true;
		return false;
	}
	bool operator==(two g){
		if (x == g.x && y == g.y)return true;
		else return false;
	}
};
two ux[200000];
two dx[200000];
two in;
int uux, ddx;
int uxx, dxx, ddxx;
long long n;
long long a, b, c, o;
long long rui[200005];
int main() {
	rui[0] = 1;
	for (int i = 1; i < 200005; i++) {
		rui[i] = rui[i - 1] * 2 % p;
	}
	scanf("%lld", &n);
	for (long long i = 0; i < n; i++) {
		scanf("%lld%lld", &a, &b);
		if (a == 0 && b == 0) {
			o++;
			continue;
		}
		if (a == 0) {
			b = 1;
		}
		if (a < 0) {
			a = -a;
			b = -b;
		}
		if (b > 0) {
			c = gcd(a, b);
			a /= c;
			b /= c;
		}
		else if (b == 0) {
			a = 1;
		}
		else if (b < 0) {
			c = gcd(a, -b);
			a /= c;
			b /= c;
		}
		if (b > 0) {
			in.x = a;
			in.y = b;
			ux[uux] = in;
			uux++;
		}
		else {
			in.x = -b;
			in.y = a;
			dx[ddx] = in;
			ddx++;
		}
	}
	std::sort(ux, ux + uux);
	std::sort(dx, dx + ddx);
	for (int i = 0; i < uux; i++) {
		uxx = 1;
		while (i < uux - 1 && ux[i] == ux[i + 1]) {
			uxx++;
			i++;
		}
		dxx = 0;
		while (dx[ddxx] < ux[i]) {
			ans *= 2;
			ans %= p;
			ddxx++;
		}
		while (dx[ddxx]==ux[i]) {
			dxx++;
			ddxx++;
		}
		ans *= (rui[uxx] + rui[dxx] - 1);
		ans %= p;
	}
	ans += o;
	ans += p - 1;
	ans %= p;
	printf("%lld\n", ans);
}