#include <iostream>
#include <map>
#include <numeric>
#include <vector>
using namespace std;
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using ll = long long;
const ll MOD = 1000000007;
ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	ll a[n], b[n];
	map<pair<ll, ll>, ll> mp;
	rep(i, n) {
		cin >> a[i] >> b[i];
		if (a[i] == 0 and b[i] == 0)
			a[i] = b[i] = 0;
		else if (a[i] == 0)
			a[i] = 0, b[i] = 1;
		else if (b[i] == 0)
			a[i] = 1, b[i] = 0;
		else {
			ll g = gcd(a[i], b[i]);
			a[i] /= g, b[i] /= g;
			if (a[i] < 0) a[i] *= -1, b[i] *= -1;
		}
		mp[{a[i], b[i]}]++;
	}
	map<pair<ll, ll>, ll> seen;
	rep(i, n) {
		ll na = a[i], nb = b[i];
		if (seen[{na, nb}]) continue;
		if (na == 0 and nb == 0) continue;
		mp[{na, nb}] = modpow(2, mp[{na, nb}]) - 1;
		if (nb > 0) {
			mp[{na, nb}] += modpow(2, mp[{nb, -na}]) - 1;
			mp[{nb, -na}] = 0;
			seen[{nb, -na}] = 1;
		} else {
			mp[{na, nb}] += modpow(2, mp[{-nb, na}]) - 1;
			mp[{-nb, na}] = 0;
			seen[{-nb, na}] = 1;
		}
		mp[{na, nb}] %= MOD;
		seen[{na, nb}] = 1;
	}
	ll ans = 1;
	for (auto p : mp) {
		if (p.first == make_pair(0LL, 0LL)) continue;
		ans *= p.second + 1;
		ans %= MOD;
	}
	cout << ans - 1 << endl;
	return 0;
}
