// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 200000, MD = 1000000007;

struct V {
	long long a, b;
} uu[N], vv[N];

long long gcd(long long a, long long b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	int n; cin >> n;
	int z = 0, pa = 1, pb = 1;
	int nu = 0, nv = 0;
	for (int i = 0; i < n; i++) {
		long long a, b; cin >> a >> b;
		if (a == 0 && b == 0) {
			z++;
			continue;
		}
		if (a == 0) {
			pa = pa * 2 % MD;
			continue;
		}
		if (b == 0) {
			pb = pb * 2 % MD;
			continue;
		}
		if (b < 0) {
			a = -a;
			b = -b;
		}
		int d = gcd(abs(a), b); a /= d, b /= d;
		if (a > 0) {
			auto &u = uu[nu++];
			u.a = a, u.b = b;
		} else {
			auto &v = vv[nv++];
			v.a = b, v.b = -a;
		}
	}
	long long ans = (pa + pb - 1) % MD;
	sort(uu, uu + nu, [] (auto &u, auto &v) { return u.a < v.a || u.a == v.a && u.b < v.b; });
	sort(vv, vv + nv, [] (auto &u, auto &v) { return u.a < v.a || u.a == v.a && u.b < v.b; });
	for (int i = 0, j = 0; i < nu || j < nv; ) {
		int mode;
		if (j == nv)
			mode = 1;
		else if (i == nu)
			mode = 2;
		else if (uu[i].a < vv[j].a)
			mode = 1;
		else if (uu[i].a > vv[j].a)
			mode = 2;
		else if (uu[i].b < vv[j].b)
			mode = 1;
		else if (uu[i].b > vv[j].b)
			mode = 2;
		else
			mode = 0;
		int pu = 1, pv = 1;
		if (mode != 2) {
			int i_ = i;
			while (i_ < nu && uu[i_].a == uu[i].a && uu[i_].b == uu[i].b) {
				pu = pu * 2 % MD;
				i_++;
			}
			i = i_;
		}
		if (mode != 1) {
			int j_ = j;
			while (j_ < nv && vv[j_].a == vv[j].a && vv[j_].b == vv[j].b) {
				pv = pv * 2 % MD;
				j_++;
			}
			j = j_;
		}
		if (mode == 1)
			ans = ans * pu % MD;
		else if (mode == 2)
			ans = ans * pv % MD;
		else
			ans = ans * (pu + pv - 1) % MD;
	}
	ans = (ans + z - 1) % MD;
	if (ans < 0)
		ans += MD;
	cout << ans << '\n';
	return 0;
}
