#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
ll s(ll x) {
	if (x > 0) return 1LL;
	if (x < 0) return -1LL;
	return 0;
}
pll simp(ll a, ll b) {
	if (a == 0 && b == 0) return {0, 0};
	if (a == 0) return {0, 1};
	if (b == 0) return {1, 0};
	ll d = __gcd(a, b);
	a /= d;
	b /= d;
	ll sgn = 1;
	if ((a > 0 && b < 0) || (a < 0 && b > 0)) sgn = -1;
	return {abs(a)*sgn, abs(b)};
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	map<pll, int> counter;
	map<pll, int> counter_ll;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		counter_ll[{a, b}]++;
	}
	ll edge_case = 0;
	for (const auto &p: counter_ll) {
		pll t = simp(p.first.first, p.first.second);
		if (t == pll(0, 0)) {
			edge_case += p.second;
			continue;
		}
		if (counter.find(t) == counter.end()) {
			counter[t] = 1;
		}
		ll pw = 1;
		for (int i = 0; i < p.second; i++) {
			pw *= 2;
			pw %= MOD;
		}
		counter[t] *= pw;
		counter[t] %= MOD;
	}
	vector<ll> S;
	//for (const auto &p: counter) {
		//cout << p.first.first << "/" << p.first.second << " == " << p.second << endl;
	//}
	while (!counter.empty()) {
		//db(counter.size());
		pll t = (*counter.begin()).first;
		ll sgn = 1;
		if (t.first <= 0) sgn = -1;
		sgn *= -1;
		pll u = {sgn*abs(t.second), abs(t.first)};
		if (t == pll(1, 0)) u = {0, 1};
		if (t == pll(0, 1)) u = {1, 0};
		if (counter.find(u) != counter.end()) {
			S.push_back((counter[u] + counter[t] - 1) % MOD);
			counter.erase(u);
			counter.erase(t);
		} else {
			S.push_back(counter[t]);
			counter.erase(t);
		}
	}

	ll ans = 1;
	for (ll a: S) {
		db(a);
		ans *= a;
		ans %= MOD;
	}
	
	ans += edge_case;
	cout << (ans - 1 + MOD) % MOD << endl;
}

