#include <bits/stdc++.h>
using namespace std;

int64_t	modpow(int64_t a, int64_t n, const int64_t mod)
{
	int64_t	result = 1;
	while (n) {
		if (n & 1) result = result * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return result;
}

int	main()
{
	int	N;
	cin >> N;
	map<pair<int64_t, int64_t>, int>	cnt_map;
	int64_t	A, B;
	int64_t	num_00 = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A >> B;
		if (A == 0 && B == 0) {
			++num_00;
			continue;
		}
		int64_t	divisor = __gcd(A, B);
		A /= divisor;
		B /= divisor;
		if (B < 0) {
			A *= -1;
			B *= -1;
		}
		auto	pr = make_pair(A, B);
		if (cnt_map.count(pr))
			++cnt_map.at(pr);
		else
			cnt_map[pr] = 1;
	}
	int64_t	mod = 1000000007;
	int64_t	total = 1;
	set<pair<int64_t, int64_t>>	appeared;
	for (auto pr : cnt_map) {
		A = pr.first.first;
		B = pr.first.second;
		if (A < 0) {
			A *= -1;
			B *= -1;
		}
		auto other = make_pair(-B, A);
		if (appeared.count(other))
			continue;
		int64_t	cnt0 = pr.second;
		if (cnt_map.count(other)) {
			int64_t	cnt1 = cnt_map.at(other);
			int64_t	tmp = modpow(2, cnt0, mod) + modpow(2, cnt1, mod) - 1;
			total = total * tmp % mod;
			appeared.insert(pr.first);
		} else {
			total = total * modpow(2, cnt0, mod);
		}
	}
	total = (total - 1 + num_00) % mod;
	if (total < 0)
		total += mod;
	cout << total << endl;
}
