#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int MOD = 1e9 + 7;
int add(ll x, ll y) {return (x+y) % MOD;}
int sub(ll x, ll y) {return add(x, MOD-y);}
int mul(ll x, ll y) {return (x*y) % MOD;}
int bp(ll x, ll y) {
	int ans = 1;
	while (y) {
		if (y&1) ans = mul(ans, x);
		x = mul(x, x);
		y>>=1;
	}
	return ans;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	ll a[n], b[n];
	int za = 0, zb = 0, zero = 0;
	map<pii,pii> cnt;
	for (int i=0; i<n; i++) {
		cin >> a[i] >> b[i];
		ll g = __gcd(abs(a[i]), abs(b[i]));
		if (g) a[i] /= g;
		if (g) b[i] /= g;
		ll p, q;
		p = a[i]; q = b[i];
		if (p==0 && q==0) zero++;
		else if (p==0) za++;
		else if (q==0) zb++;
		else if (cnt.count({p, q})) cnt[{p, q}].first++;
		else if (cnt.count({-p, -q})) cnt[{-p, -q}].first++;
		else if (cnt.count({-q, p})) cnt[{-q, p}].second++;
		else if (cnt.count({q, -p})) cnt[{q, -p}].second++;
		else cnt[{p, q}].first++;
	}
	int ca, cb, ans = zero+1;
	ca = mul(ans, bp(2, za));
	cb = mul(ans, bp(2, zb));
	ans = sub(add(ca, cb), ans);
	for (auto xx : cnt) {
		ca = mul(ans, bp(2, xx.second.first));
		cb = mul(ans, bp(2, xx.second.second));
		ans = sub(add(ca, cb), ans);
	}
	cout << sub(ans, 1) << '\n';
}