#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int N = 2e5+5;
ll binpow(ll a, ll b) {
	ll ret = 1;
	a %= mod;
	while (b) {
		if (b & 1) ret = ret * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ret % mod;
}

int main() {
	int n;
	scanf("%d", &n);
	map<pair<ll, ll>, int> mp;
	map<pair<ll, ll>, bool> flag;
	for (int i = 0; i < n; i++) {
		ll x, y; scanf("%lld%lld", &x, &y);
		ll g = __gcd(abs(x), abs(y));
		if (x * y > 0) mp[{abs(x/g), abs(y/g)}]++;
		else if (x * y < 0) mp[{-abs(x/g), abs(y/g)}]++;
		else if (x && y == 0) mp[{1, 0}]++;
		else if (x == 0 && y) mp[{0, 1}]++;
		else mp[{0, 0}]++;
	}
	ll ans = 1;
	for (auto elem : mp) {
		auto p = elem.first;
	//	printf("%d %d %d\n", elem.first.first, elem.first.second, elem.second); 
		if (!flag[p]) {
			if (p.first == 0 && p.second == 0) continue;
			pair<ll, ll> q = {p.second, -p.first};
		//	if (mp.count(q) == 0) q = {-q.first, -q.second};
			if (mp.count(q)) {
				flag[q] = 1;
				ans = (ans * ((binpow(2, mp[p]) + binpow(2, mp[q])) % mod - 1)) % mod;
			} else
				ans = (ans * binpow(2, mp[p])) % mod;
			flag[p] = 1;
		}
	}
	ans--;
	ans = (ans + mp[{0, 0}]) % mod;
	printf("%lld\n", (ans + mod) % mod);
	return 0;
}