#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 200010;
const int mod = 1000000007;

ll a[N], b[N], r[N];
map<pair<ll, ll>, int> mp;

int main() {
	int n, k = 0, x = 0, y = 0;
	scanf("%d", &n);
	r[0] = 1;
	for(int i=1; i<=n; i++)
		r[i] = r[i-1]*2%mod;
	for(int i=1; i<=n; i++) {
		++k;
		scanf("%lld%lld", &a[k], &b[k]);
		if(a[k]==0 || b[k]==0) {
			if(a[k]==0 && b[k]!=0)
				x++;
			else if(a[k]!=0 && b[k]==0)
				y++;
			k--;
			continue;
		}
		int flag = 1;
		if(a[k]<0) {
			a[k] = -a[k];
			flag = -flag;
		}
		if(b[k]<0) {
			b[k] = -b[k];
			flag = -flag;
		}
		ll d = __gcd(a[k], b[k]);
		a[k] /= d; b[k] /= d;
		a[k] *= flag;
		mp[{a[k], b[k]}]++;
	}
	ll ans = (r[x]+r[y]-1)%mod;
	// printf("k=%d\n", k);
	for(int i=1; i<=k; i++) {
		// printf("%d\n", i);
		if(mp[{a[i], b[i]}]==0)
			continue;
		if(a[i]<0) {
			int p = mp[{a[i], b[i]}], q = mp[{b[i], -a[i]}];
			ans = ans*(r[p]+r[q]-1)%mod;
			mp[{a[i], b[i]}] = mp[{b[i], -a[i]}] = 0;
		}
		else {
			int p = mp[{a[i], b[i]}], q = mp[{-b[i], a[i]}];
			ans = ans*(r[p]+r[q]-1)%mod;
			mp[{a[i], b[i]}] = mp[{-b[i], a[i]}] = 0;
		}
	}
	printf("%lld\n", (ans-1+mod)%mod);
	return 0;
}