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

using namespace std;

using PII = pair<int, int>;
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, vector<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;
			}
		}
		PLL p;
		if (b >= 0) {
			p = make_pair(a, b);
		} else {
			p = make_pair(abs(b), abs(a));
		}


		if (iwashi.count(p) == 0) {
			if (b >= 0) {
				iwashi[p] = {1, 0};
			} else {
				iwashi[p] = {0, 1};
			}
		} else {
			int idx = b >= 0 ? 0 : 1;
			iwashi[p][idx]++;
		}
// printf("ab %3lld %3lld: p %3lld, %3lld, v %d %d\n", a, b, p.first, p.second, iwashi[p][0], iwashi[p][1]);
	}


	long long ans = 1;
	for (auto p: iwashi) {
// printf("----\n");
		auto v = p.second;
// printf("%3lld, %3lld: %d %d\n", p.first.first, p.first.second, v[0], v[1]);
		long long x = v[0];
		long long y = v[1];

		long long tmp1 = pow2[x + y];
		long long tmp2 = pow2[x] - 1;
		long long tmp3 = pow2[y] - 1;
		if (tmp2 < 0) {
			tmp2 += mod;
		}
		if (tmp3 < 0) {
			tmp3 += mod;
		}

		long long tmp = tmp1 - tmp2 * tmp3 % mod;
// cout << tmp << endl;
		if (tmp < 0) {
			tmp += mod;
		}
		tmp %= mod;
		ans *= tmp;
		ans %= mod;

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

	return 0;
}
