#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
using pr = pair<ll, ll>;

int N;
map<pr, int> m;
pr A[200005];
ll ans, cnt, p[200005];

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main() {
	scanf("%d", &N);
	p[0] = 1LL;
	for(int i=1; i<=200000; i++) p[i] = p[i-1] * 2 % MOD;
	for(int i=1; i<=N; i++) {
		ll x, y;
		scanf("%lld %lld", &x, &y);
		if(x == 0 && y == 0) {
			N--, i--, cnt++;
			continue;
		}
		if(x < 0 || (x == 0 && y < 0)) x = -x, y = -y;
		ll g = gcd(x, abs(y));
		x /= g, y /= g;
		m[pr(x, y)]++;
		A[i] = pr(x, y);
	}
	ans = 1LL;
	for(auto it : m) {
		ll x = it.first.first, y = it.first.second;
		int c1 = it.second;
		int c2 = (m.find(pr(y, -x)) != m.end() ? m[pr(y, -x)] : 0);
		if(y <= 0 && m.find(pr(-y, x)) != m.end()) continue;
		ans = ans * (p[c1] + p[c2] - 1LL) % MOD;
	}
	printf("%lld\n", (ans + cnt + MOD - 1LL) % MOD);
}