#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200010;
const ll mod = 1e9 + 7;
int n;
ll a[N], b[N];
map<pair<ll, ll>, ll> mp;
ll ans = 1, cnt1, cnt2, cnt;
ll ksm(ll p, ll q) {
	ll ret = 1;
	while (q) {
		if (q & 1) ret = (ret * p) % mod;
		p = (p * p) % mod;
		q = q >> 1;
	}
	return ret;
}
ll f(ll x) {
	return ksm(2, x);
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i];
		if (a[i] == 0 || b[i] == 0) {
			if (a[i] == 0 && b[i] == 0) {
				cnt++;
			} else if (a[i] == 0) {
				cnt1++;
			} else if (b[i] == 0) {
				cnt2++;
			}
			continue;
		}
		ll gcd = __gcd(a[i], b[i]);
		a[i] /= gcd;
		b[i] /= gcd;
		if (a[i] < 0) a[i] = -a[i], b[i] = -b[i];
//		cout << a[i] << " " << b[i] << endl;
		mp[make_pair(a[i], b[i])]++;
	}
	for (map<pair<ll, ll>, ll>::iterator it = mp.begin(); it != mp.end(); it++) {
		int u = it->first.first;
		int v = it->first.second;
//		cout << u << " " << v << endl;
		ll now = f(mp[make_pair(u, v)]);
//		cout << f(mp[make_pair(u, v)]) << endl;
		mp[make_pair(u, v)] = 0;
		v = -v;
		if (v < 0) v = -v, u = -u;
		if (mp.count(make_pair(v, u))) {
			now = (now + f(mp[make_pair(v, u)]) - 1) % mod;
			mp[make_pair(v, u)] = 0;
		}
		now = now % mod;
//		cout << now << endl;
		ans = (ans * now) % mod;
	}
	ans = (ans * ((f(max(cnt1, cnt2)) + f(min(cnt1, cnt2)) - 1) % mod)) % mod;
	ans += cnt;
	cout << (ans - 1 + mod) % mod;
	return 0;
}