#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>
#include <map>

using namespace std;

using PLL = pair<long long, long long>;

const int mod = 1e9 + 7;

int main() {
	int n;
	cin >> n;

	vector<long long> pow2(n);
	pow2[0] = 1;
	for (int i = 1; i < n; i++) {
		pow2[i] = pow2[i - 1] * 2 % mod;
	}

	long long a, b;
	map<PLL, int> iwashi;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		if (a == 0 && b == 0) {
		} else if (a == 0) {
			b = 1;
		} else if (b == 0) {
			a = 1;
		} else {
			long long g = gcd(abs(a), abs(b));
			a /= g;
			b /= g;
			if (a < 0) {
				a *= -1;
				b *= -1;
			}
		}
		iwashi[make_pair(a, b)]++;
	}


	set<PLL> used;

	long long ans = 1;
	for (auto p: iwashi) {
// printf("----\n");
// printf("%lld %lld %d\n", p.first.first, p.first.second, p.second);
		if (used.count(p.first)) {
// printf("continue\n");
			continue;
		}

		used.insert(p.first);

		PLL q = p.first;
		long long x = q.first;
		long long y = q.second;


		int s = p.second;
		int t = 0;

		auto p1 = make_pair(y, -x);
		auto p2 = make_pair(-y, x);
		auto it1 = iwashi.find(p1);
		auto it2 = iwashi.find(p2);
		if (it1 != iwashi.end()) {
			t += iwashi[p1];
			used.insert(p1);
// printf("insert %lld %lld\n", p1.first, p1.second);
		}
		if (it2 != iwashi.end()) {
			t += iwashi[p2];
			used.insert(p2);
// printf("insert %lld %lld\n", p2.first, p2.second);
		}
// printf("s %d, t %d\n", s, t);
		long long tmp1 = pow2[s + t];
		long long tmp2 = pow2[s] - 1;
		long long tmp3 = pow2[t] - 1;
		if (tmp2 < 0) {
			tmp2 += mod;
		}
		if (tmp3 < 0) {
			tmp3 += mod;
		}

		long long tmp = tmp1 - tmp2 * tmp3 % mod;
// cout << tmp << endl;
		tmp %= mod;
		ans *= tmp;
		ans %= mod;

	}
	ans--;
	if (ans < 0) {
		ans += mod;
	}
	cout << ans << endl;

	return 0;
}
